From df87572b0d10e07729deddc4d267489636d1761d Mon Sep 17 00:00:00 2001 From: Arpit Date: Tue, 29 May 2018 00:12:57 +0530 Subject: [PATCH] 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. --- sinatra-contrib/spec/required_params_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sinatra-contrib/spec/required_params_spec.rb b/sinatra-contrib/spec/required_params_spec.rb index e27e6c0a..f623284b 100644 --- a/sinatra-contrib/spec/required_params_spec.rb +++ b/sinatra-contrib/spec/required_params_spec.rb @@ -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