0

I am having problems with my application being able to find my users table in my database.

rake db:test:prepare is not solving the problem for me. It doesn't do anything when I enter it.

Failures:

  1) Micropost
     Failure/Error: let(:user) { FactoryGirl.create(:user) }
     ActiveRecord::StatementInvalid:
       Could not find table 'users'
     # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in <top (required)>'
     # ./spec/models/micropost_spec.rb:8:in `block (2 levels) in <top (required)>'

  2) Micropost
     Failure/Error: let(:user) { FactoryGirl.create(:user) }
     ActiveRecord::StatementInvalid:
       Could not find table 'users'
     # ./spec/models/micropost_spec.rb:5:in `block (2 levels) in <top (required)>'
     # ./spec/models/micropost_spec.rb:8:in `block (2 levels) in <top (required)>'

Finished in 0.00319 seconds
2 examples, 2 failures

Failed examples:

rspec ./spec/models/micropost_spec.rb:13 # Micropost
rspec ./spec/models/micropost_spec.rb:14 # Micropost
4

2 回答 2

0

假设您已经迁移了您的开发数据库,​​只需运行rake db:test:clone

于 2013-04-22T08:41:26.087 回答
0

你必须运行rake db:migrate 并且 rake db:test:prepare喜欢:

rake db:migrate db:test:prepare
于 2013-04-22T06:58:35.230 回答