0

I am new to creating an API with Rails and am trying to create a test.

require "spec_helper"

describe "/api/v1/iosapps", :type => :api do


    context "view all apps" do
        let(:url) { "/api/v1/iosapps" }
        it "json" do
            get "#{url}.json"
            iosapps_json = Iosapp.all.to_json
            last_response.body.should eql(iosapps_json)
            last_response.status.should eql(200)
            iosapps = JSON.parse(last_response.body)

            iosapps.any? do |p|
                p["name"] == iosapp.name
            end.should be_true
        end
    end

end

I get an error saying the below. Any advice on how to fix this?

Failure/Error: get "#{url}.json"
 ActiveRecord::StatementInvalid:
   Could not find table 'iosapps'

1 Answer 1

1

Test db is not ready. You need to run

rake db:migrate
rake db:test:prepare
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.