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
In Rails 3, you can skip the header and @request.env stuff and just add a format parameter to your post call, e.g.:
@request.env
format
post :create, format: :json, param: 'Value of Param'