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 slightly more elegant test is to use the header helper:
header "HTTP_ACCEPT", "application/json" json = {.... data ....}.to_json post '/model1.json', json
Now this does exactly the same thing as setting @env; it's just a bit prettier.
@env