Maintenance: Fixed typo (refresh_xoaut2 -> refresh_xoauth2).
This commit is contained in:
parent
85573432c0
commit
a90423cc88
4 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ class Channel < ApplicationModel
|
|||
store :options
|
||||
store :preferences
|
||||
|
||||
after_initialize :refresh_xoaut2!
|
||||
after_initialize :refresh_xoauth2!
|
||||
after_create :email_address_check
|
||||
after_update :email_address_check
|
||||
after_destroy :email_address_check
|
||||
|
@ -336,7 +336,7 @@ get instance of channel driver
|
|||
self.class.driver_class(options[:adapter])
|
||||
end
|
||||
|
||||
def refresh_xoaut2!
|
||||
def refresh_xoauth2!
|
||||
return if options.dig(:auth, :type) != 'XOAUTH2'
|
||||
|
||||
result = ExternalCredential.refresh_token(options[:auth][:provider], options[:auth])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FactoryBot.define do
|
||||
factory :channel do
|
||||
# ensure the `refresh_xoaut2!` `after_initialize` callback gets executed
|
||||
# ensure the `refresh_xoauth2!` `after_initialize` callback gets executed
|
||||
# https://stackoverflow.com/questions/5916162/problem-with-factory-girl-association-and-after-initialize#comment51639005_28057070
|
||||
initialize_with { new(attributes) }
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ RSpec.describe ExternalCredential::Google do
|
|||
|
||||
it 'does not refresh' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.not_to change { channel.options['auth']['created_at'] }
|
||||
end
|
||||
end
|
||||
|
@ -265,7 +265,7 @@ RSpec.describe ExternalCredential::Google do
|
|||
|
||||
it 'refreshes token' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.to change { channel.options['auth'] }.to a_hash_including(
|
||||
'created_at' => Time.zone.now,
|
||||
'access_token' => refreshed_access_token,
|
||||
|
@ -286,7 +286,7 @@ RSpec.describe ExternalCredential::Google do
|
|||
shared_examples 'failed attempt' do
|
||||
it 'raises an exception' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.to raise_error(RuntimeError, exception_message)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -202,7 +202,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
|||
|
||||
it 'does not refresh' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.not_to change { channel.options['auth']['created_at'] }
|
||||
end
|
||||
end
|
||||
|
@ -226,7 +226,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
|||
|
||||
it 'refreshes token' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.to change { channel.options['auth'] }.to a_hash_including(
|
||||
'created_at' => Time.zone.now,
|
||||
'access_token' => refreshed_access_token,
|
||||
|
@ -247,7 +247,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
|||
shared_examples 'failed attempt' do
|
||||
it 'raises an exception' do
|
||||
expect do
|
||||
channel.refresh_xoaut2!
|
||||
channel.refresh_xoauth2!
|
||||
end.to raise_error(RuntimeError, exception_message)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue