Is there a nicer way to set POST body data in rspec on rails? -
than request.env['raw_post_data'] = json_body
?
i'm not sure if mean, can set request headers indicate json:
describe "post 'create'" "should successful" request.env["http_accept"] = "application/json" post 'create', :article => { :title => "foo" }.to_json response.should be_success end end
Comments
Post a Comment