accepts_nested_attributes_for
を使用するように私のスパゲッティコードを変換するとき、私はRSpec統合テストを書いています。私はこのようなスニペットがあります。もちろんRSpec統合テストでネストされた属性をPOSTする方法は?
# file: spec/requests/wizard_spec.rb
describe 'POST /wizard with address' do
before(:each) do
@premise_attributes = {
"address"=>"600 Mellow Ave, Mellow Park, CA 94025, USA",
}
end
it 'should succeed' do
post :create, "wizard" => { "premise_attributes" => @premise_attributes }
response.status.should be(200)
end
end
を、これはで失敗します。
Failure/Error: post :create, "wizard" => { "premise_attributes" => @premise_attributes }
ArgumentError:
bad argument(expected URI object or URI string)
はPOST-可能な形式にネストされた属性のハッシュを変換する方法はありますか?
(関連はあまり重要:?どこpost
方法を文書または定義されている、私はそれが本当に引数として受け入れるか見てみたいと思います。)