diff --git a/spec/grape/middleware/formatter_spec.rb b/spec/grape/middleware/formatter_spec.rb index 87484b4c9c..aeab1c4e10 100644 --- a/spec/grape/middleware/formatter_spec.rb +++ b/spec/grape/middleware/formatter_spec.rb @@ -1,12 +1,11 @@ require 'spec_helper' describe Grape::Middleware::Formatter do - subject { Grape::Middleware::Formatter.new(app, options) } + subject { Grape::Middleware::Formatter.new(app) } before { allow(subject).to receive(:dup).and_return(subject) } let(:body) { { 'foo' => 'bar' } } let(:app) { ->(_env) { [200, {}, [body]] } } - let(:options) { {} } context 'serialization' do let(:body) { { 'abc' => 'def' } } @@ -327,14 +326,12 @@ def self.call(_, _) end context 'custom parser raises exception and rescue options are enabled for backtrace and original_exception' do - let(:options) { - { + it 'adds the backtrace and original_exception to the error output' do + subject = Grape::Middleware::Formatter.new( + app, rescue_options: { backtrace: true, original_exception: true }, parsers: { json: ->(_object, _env) { raise StandardError, 'fail' } } - } - } - - it 'adds the backtrace and original_exception to the error output' do + ) io = StringIO.new('{invalid}') error = catch(:error) { subject.call(