spec/grape/middleware/formatter_spec.rb in grape-0.6.1 vs spec/grape/middleware/formatter_spec.rb in grape-0.7.0

- old
+ new

@@ -70,13 +70,16 @@ end end context 'detection' do - it 'uses the extension if one is provided' do + it 'uses the xml extension if one is provided' do subject.call('PATH_INFO' => '/info.xml') subject.env['api.format'].should == :xml + end + + it 'uses the json extension if one is provided' do subject.call('PATH_INFO' => '/info.json') subject.env['api.format'].should == :json end it 'uses the format parameter if one is provided' do @@ -193,11 +196,11 @@ 'REQUEST_METHOD' => method, 'CONTENT_TYPE' => content_type, 'rack.input' => io, 'CONTENT_LENGTH' => io.length ) - subject.env['rack.request.form_hash']['is_boolean'].should be_true + subject.env['rack.request.form_hash']['is_boolean'].should be true subject.env['rack.request.form_hash']['string'].should == 'thing' end end end it "parses the chunked body from #{method} and copies values into rack.request.from_hash" do @@ -207,11 +210,11 @@ 'REQUEST_METHOD' => method, 'CONTENT_TYPE' => 'application/json', 'rack.input' => io, 'HTTP_TRANSFER_ENCODING' => 'chunked' ) - subject.env['rack.request.form_hash']['is_boolean'].should be_true + subject.env['rack.request.form_hash']['is_boolean'].should be true subject.env['rack.request.form_hash']['string'].should == 'thing' end it "rewinds IO" do io = StringIO.new('{"is_boolean":true,"string":"thing"}') io.read @@ -220,10 +223,10 @@ 'REQUEST_METHOD' => method, 'CONTENT_TYPE' => 'application/json', 'rack.input' => io, 'HTTP_TRANSFER_ENCODING' => 'chunked' ) - subject.env['rack.request.form_hash']['is_boolean'].should be_true + subject.env['rack.request.form_hash']['is_boolean'].should be true subject.env['rack.request.form_hash']['string'].should == 'thing' end it 'parses the body from an xml #{method} and copies values into rack.request.from_hash' do io = StringIO.new('<thing><name>Test</name></thing>') subject.call(