Skip to content

Commit

Permalink
Improve custom formatter definition inside the spec
Browse files Browse the repository at this point in the history
  • Loading branch information
prikha committed Mar 6, 2019
1 parent e1daad4 commit 3b097ca
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions spec/faraday/response/logger_spec.rb
Expand Up @@ -67,8 +67,8 @@
end

context 'with custom formatter' do
before do
class CustomFormatter < Faraday::Logging::Formatter
let(:formatter_class) do
Class.new(Faraday::Logging::Formatter) do
def initialize(*args)
super
end
Expand All @@ -83,11 +83,7 @@ def response(_env)
end
end

after do
Object.send(:remove_const, :CustomFormatter)
end

let(:logger_options) { { formatter: CustomFormatter } }
let(:logger_options) { { formatter: formatter_class } }

it 'logs with custom formatter' do
conn.get '/hello'
Expand Down

0 comments on commit 3b097ca

Please sign in to comment.