spec/subroute_spec.rb in lookout-rack-utils-1.6.0 vs spec/subroute_spec.rb in lookout-rack-utils-1.7.1

- old
+ new

@@ -16,10 +16,14 @@ get '/subrouted/:id' do |id| subroute!('/test_route', :id => id) end + put '/subrouted/request_params' do + subroute!('/test_route', 'key' => 'value') + end + delete '/test_delete' do status 201 { :deleted => true }.to_json end @@ -42,13 +46,24 @@ context "with params" do let(:id) { 1 } let(:body) { { :key => 'value', :id => "#{id}" }.to_json } - subject(:subrouted) { get "/subrouted/#{id}?key=value" } - it 'should return expected value' do - expect([subrouted.status, subrouted.body]).to eql [200, body] + context 'a get route' do + subject(:subrouted) { get "/subrouted/#{id}?key=value" } + + it 'should return expected value' do + expect([subrouted.status, subrouted.body]).to eql [200, body] + end + end + + context 'params added by subrouter, non-GET method' do + subject(:subrouted) { put '/subrouted/request_params' } + + it 'should return expected value' do + expect([subrouted.status, subrouted.body]).to eql [200, { 'key' => 'value' }.to_json] + end end end context 'changing the http verb' do context 'to a valid verb' do