I\'m trying to build an rspec test that sends JSON (or XML) via POST. However, I can\'t seem to actually get it working:
json = {.... data ....}.to_json
A lot of frustration and variations and that's what worked for me. Rails 3.2.12 Rspec 2.10
@request.env["HTTP_ACCEPT"] = "application/json" @request.env["CONTENT_TYPE"] = "application/json" put :update, :id => 1, "email" => "bing@test.com"