我正在尝试使用 Rspec 测试控制器的这一部分:
@supercar = Supercar.find(params[:id])
这是我的控制器规格来测试上面提到的部分:
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
...
但是,我尝试运行 command rake db:migrate
,但仍然收到此错误:
Failure/Error: @supercar = Factory :supercar
ActiveRecord::StatementInvalid:
Could not find table 'supercar'