Skip to content

Instantly share code, notes, and snippets.

@ppadron
Created December 20, 2014 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppadron/2d40ccd7a3349366dd8b to your computer and use it in GitHub Desktop.
Save ppadron/2d40ccd7a3349366dd8b to your computer and use it in GitHub Desktop.
it 'should not consider as a missing attribute a value that evaluates to false' do
subject.params do
requires :first
optional :false
end
subject.post '/declared' do
error!('expected false', 400) if declared(params, include_missing: false)[:false] != false
''
end
post '/declared', MultiJson.dump(first: 'one', false: false), 'CONTENT_TYPE' => 'application/json'
expect(last_response.status).to eq(201)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment