Skip to content

Instantly share code, notes, and snippets.

@base10
Created March 24, 2009 02:18
Show Gist options
  • Save base10/83894 to your computer and use it in GitHub Desktop.
Save base10/83894 to your computer and use it in GitHub Desktop.
def post_contact_json
contact = {
:contact => {
:email => '[email protected]',
:verify_email => '[email protected]',
:first_name => 'joe',
:last_name => 'test',
:phone => '919-555-1212',
:responses_attributes => {
0 => {
:order_number => '1234567890',
:subject => 'This is a subject',
:body => 'Lorum Ipsum',
:message_id => messages(:support).id
}
}
}
}
request.env['CONTENT_TYPE'] = 'application/json'
request.env['HTTP_ACCEPT'] = 'application/json'
request.env["RAW_POST_DATA"] = contact.to_json
post :create
end
it "should return a status 201" do
post_contact_json
response.status.to_i.should == 201
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment