spec/grape/middleware/formatter_spec.rb in grape-0.5.0 vs spec/grape/middleware/formatter_spec.rb in grape-0.6.0

- old
+ new

@@ -1,10 +1,10 @@ require 'spec_helper' describe Grape::Middleware::Formatter do subject{ Grape::Middleware::Formatter.new(app) } - before{ subject.stub!(:dup).and_return(subject) } + before{ subject.stub(:dup).and_return(subject) } let(:app){ lambda{|env| [200, {}, [@body || { "foo" => "bar" }]]} } context 'serialization' do it 'looks at the bodies for possibly serializable data' do @@ -35,11 +35,11 @@ subject.call({'PATH_INFO' => '/somewhere.xml', 'HTTP_ACCEPT' => 'application/json'}).last.each{|b| b.should == '<bar/>'} end end context 'error handling' do - let(:formatter) { stub(:formatter) } + let(:formatter) { double(:formatter) } before do Grape::Formatter::Base.stub(:formatter_for) { formatter } end it 'rescues formatter-specific exceptions' do @@ -170,10 +170,10 @@ body.body.should == ['CUSTOM JSON FORMAT'] end end context 'input' do - [ "POST", "PATCH", "PUT" ].each do |method| + [ "POST", "PATCH", "PUT", "DELETE" ].each do |method| [ "application/json", "application/json; charset=utf-8" ].each do |content_type| context content_type do it 'parses the body from #{method} and copies values into rack.request.form_hash' do io = StringIO.new('{"is_boolean":true,"string":"thing"}') subject.call({