Reputation: 128
I am trying to test this part of controller with Rspec:
@supercar = Supercar.find(params[:id])
Here is my controller spec to test the part mentioned above:
before (:each) do
@supercar = Factory :supercar
end
describe "show" do
it "assigns the requested supercar to the @supercar" do
get :show, :id => @supercar.id
assigns(:supercar).should == @supercar
end
...
However, I've tried to run command rake db:migrate
, but still getting this error:
Failure/Error: @supercar = Factory :supercar
ActiveRecord::StatementInvalid:
Could not find table 'supercar'
Upvotes: 1
Views: 413
Reputation: 32
The solution is to run this command:
rake db:test:prepare
It is preparing the test database, by loading the scheme there.
Upvotes: 1