1
为什么我得到下面的错误? 在控制台中运行rspec测试时,出现'post'未知的错误。然而,这是失败的结构为这样的代码行:Rspec ArgumentError,对象未定义
post :create, valid_params
这样:
it "assigns the new post to @post" do
post :create, post: {title: RandomData.random_sentence, body: RandomData.random_paragraph}
expect(assigns(:post)).to eq Post.last
end
以下是错误
1) PostsController POST create assigns the new post to @post
Failure/Error: post :create, post: {title: RandomData.random_sentence, body: RandomData.random_paragraph}
ArgumentError:
unknown keyword: post
这样做,谢谢塞巴斯蒂安帕尔马 – GMarx