我收到以下错误,即使在执行rake db:test:prepare
. 我正在运行rails 4.0。
1) Core::PostsController GET index assigns all posts as @posts
Failure/Error: post = Post.create! valid_attributes
ActiveRecord::StatementInvalid:
Could not find table 'core_posts'
# ./spec/controllers/core/posts_controller_spec.rb:36:in `block (3 levels) in <module:Core>'
我在引擎内运行这个测试,所以它可能是相关的吗?我的测试如下所示:
module Core
describe PostsController do
# This should return the minimal set of attributes required to create a valid
# Post. As you add validations to Post, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { } }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# PostsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all posts as @posts" do
post = Post.create! valid_attributes
get :index, {}, valid_session
assigns(:posts).should eq([post])
end
end
end
end
有任何想法吗?谢谢!