Ruby on rails 失败/错误:post:create,game_session:{}ArgumentError:分配属性时,必须将散列作为参数传递
我们试图在RSpec中运行一个简单的post:create,但是我们得到了错误: 失败/错误:post:创建,游戏会话:{} 参数错误: 分配属性时,必须将哈希作为参数传递Ruby on rails 失败/错误:post:create,game_session:{}ArgumentError:分配属性时,必须将散列作为参数传递,ruby-on-rails,rspec,Ruby On Rails,Rspec,我们试图在RSpec中运行一个简单的post:create,但是我们得到了错误: 失败/错误:post:创建,游戏会话:{} 参数错误: 分配属性时,必须将哈希作为参数传递 describe "starting a new test with GameSessionsController#create" do it "creates a new game session" do login_user game_session_count = GameSessi
describe "starting a new test with GameSessionsController#create" do
it "creates a new game session" do
login_user
game_session_count = GameSession.count
post :create # Here is the error
expect(GameSession.count).to eq( game_session_count + 1 )
expect(response).to redirect_to new_game_session_current_question_path
end
end
我们的路由文件只包含
资源:游戏会话
,我们的控制器是标准的。您可以编辑您的问题并添加相关的控制器代码吗?注意:错误消息说出错的行包含:post:创建,游戏会话:{}
不仅仅是post:create
-您确定您向我们展示了正确的代码行吗?