Contrib: add an example to required params spec

Ensures that required_params doesn't fail
abruptly when a key in params it expected
to be a hash turns out to not be.

It fails currently.
This commit is contained in:
Arpit 2018-05-29 00:12:57 +05:30
parent 5149dc9e0b
commit df87572b0d
No known key found for this signature in database
GPG Key ID: 71E79889EB580242
1 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,10 @@ describe Sinatra::RequiredParams do
get('/', :p1 => 1, :p2 => {:p21 => 21})
expect(last_response.status).to eq(200)
end
it 'return 400 if p2 is not a hash' do
get('/', :p1 => 1, :p2 => 2)
expect(last_response.status).to eq(400)
end
end
context "complex keys" do
before do