spec/grape/middleware/formatter_spec.rb in grape-0.19.2 vs spec/grape/middleware/formatter_spec.rb in grape-1.0.0
- old
+ new
@@ -9,11 +9,11 @@
context 'serialization' do
let(:body) { { 'abc' => 'def' } }
it 'looks at the bodies for possibly serializable data' do
_, _, bodies = *subject.call('PATH_INFO' => '/somewhere', 'HTTP_ACCEPT' => 'application/json')
- bodies.each { |b| expect(b).to eq(MultiJson.dump(body)) }
+ bodies.each { |b| expect(b).to eq(::Grape::Json.dump(body)) }
end
context 'default format' do
let(:body) { ['foo'] }
it 'calls #to_json since default format is json' do
@@ -272,10 +272,14 @@
'REQUEST_METHOD' => method,
'CONTENT_TYPE' => 'application/xml',
'rack.input' => io,
'CONTENT_LENGTH' => io.length
)
- expect(subject.env['rack.request.form_hash']['thing']['name']).to eq('Test')
+ if Object.const_defined? :MultiXml
+ expect(subject.env['rack.request.form_hash']['thing']['name']).to eq('Test')
+ else
+ expect(subject.env['rack.request.form_hash']['thing']['name']['__content__']).to eq('Test')
+ end
end
[Rack::Request::FORM_DATA_MEDIA_TYPES, Rack::Request::PARSEABLE_DATA_MEDIA_TYPES].flatten.each do |content_type|
it "ignores #{content_type}" do
io = StringIO.new('name=Other+Test+Thing')
subject.call(