Skip to content

Instantly share code, notes, and snippets.

@jumski
Last active August 29, 2015 13:56
Show Gist options
  • Save jumski/8932868 to your computer and use it in GitHub Desktop.
Save jumski/8932868 to your computer and use it in GitHub Desktop.
Sending invalid json in request specs
it 'responds properly when invalid json was sent' do
send method, path, '{invalid_json]',
'CONTENT_TYPE' => 'application/json',
'ACCEPT' => 'application/json'
expect(response.code.to_i).to eq 400
expect(JSON.parse(response.body)).to equal({'message' => 'Problems parsing JSON'})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment