Skip to content

Commit

Permalink
Stub Rails.logger.error
Browse files Browse the repository at this point in the history
When fetching headers, we rescue any authentication error and set the headers as application/json
https://github.com/3scale/zync/blob/464cd87fda2275468ad4a94d9fbb54cfe98df10e/app/adapters/generic_adapter.rb#L136

The test rescues some error that is never raised
  • Loading branch information
hallelujah committed Jun 4, 2019
1 parent b6b04a2 commit c9923a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/adapters/generic_adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,22 @@ class GenericAdapterTest < ActiveSupport::TestCase

adapter = GenericAdapter.new('http://id:[email protected]:3000/auth/realm/name')

error = assert_raises GenericAdapter::OIDC::AuthenticationError do
log = Object.new
class << log
def error_object
@error
end

def error(object)
@error = object
end
end

Rails.logger.stub :error, log.method(:error) do
adapter.test
end

error = log.error_object
assert_kind_of Faraday::TimeoutError, error.cause
assert error.bugsnag_meta_data.presence
assert_requested get_token
Expand Down

0 comments on commit c9923a8

Please sign in to comment.