在我的规范中,当我运行下面的 POST 请求时,一切正常。
before do
request_payload = {
player: {
first_name: "Joe",
last_name: "Carradine",
team_id: "1"
}
}
post :create, request_payload
end
但是当我运行 PUT 规范时:
before do
request_payload = {
player: {
first_name: "Buck",
last_name: "Carradine",
team_id: "1"
}
}
put :update, id: 3, request_payload
end
我收到这样的错误:
[filename]_spec.rb:139: syntax error, unexpected '\n', expecting tASSOC (SyntaxError)
[filename]_spec.rb:198: syntax error, unexpected $end, expecting keyword_end
有任何想法吗?我不知道 PUT 有不同的语法吗?