Skip to content

Commit

Permalink
trying to fix random test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsg committed Jul 11, 2017
1 parent 4521544 commit 264aee1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions spec/grape/middleware/formatter_spec.rb
Original file line number Diff line number Diff line change
@@ -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' } }
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 264aee1

Please sign in to comment.