forked from open-telemetry/opentelemetry-ruby-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add ActionMailer CI (open-telemetry#976)
* ci: Add ActionMailer CI * ci: Linter fixes * squash: drop pry-byebug
- Loading branch information
1 parent
02df9ba
commit 6762619
Showing
5 changed files
with
20 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
gem: | ||
- action_mailer | ||
- action_pack | ||
- action_view | ||
- active_job | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ | |
let(:instrumentation) { OpenTelemetry::Instrumentation::ActionMailer::Instrumentation.instance } | ||
let(:payload) do | ||
{ | ||
:mailer => "TestMailer", | ||
:message_id => "[email protected]", | ||
:subject => "Welcome to OpenTelemetry!", | ||
:to => ["[email protected]"], | ||
:from => ["[email protected]"], | ||
:bcc => ["[email protected]"], | ||
:cc => ["[email protected]"], | ||
:perform_deliveries => true | ||
mailer: 'TestMailer', | ||
message_id: '[email protected]', | ||
subject: 'Welcome to OpenTelemetry!', | ||
to: ['[email protected]'], | ||
from: ['[email protected]'], | ||
bcc: ['[email protected]'], | ||
cc: ['[email protected]'], | ||
perform_deliveries: true | ||
} | ||
end | ||
|
||
|
@@ -62,14 +62,14 @@ | |
describe '#transform_payload' do | ||
it 'with simple payload' do | ||
payload = { | ||
:mailer => "TestMailer", | ||
:message_id => "[email protected]", | ||
:subject => "Welcome to OpenTelemetry!", | ||
:to => ["[email protected]"], | ||
:from => ["[email protected]"], | ||
:bcc => ["[email protected]"], | ||
:cc => ["[email protected]"], | ||
:perform_deliveries => true | ||
mailer: 'TestMailer', | ||
message_id: '[email protected]', | ||
subject: 'Welcome to OpenTelemetry!', | ||
to: ['[email protected]'], | ||
from: ['[email protected]'], | ||
bcc: ['[email protected]'], | ||
cc: ['[email protected]'], | ||
perform_deliveries: true | ||
} | ||
tranformed_payload = instrumentation.send(:transform_payload, payload) | ||
|
||
|
@@ -85,15 +85,14 @@ | |
|
||
describe '#ecs_mail_convention' do | ||
it 'with user-defined payload' do | ||
|
||
original_config = instrumentation.instance_variable_get(:@config) | ||
modified_config = original_config.dup | ||
|
||
modified_config[:notification_payload_transform] = lambda { |payload| payload['email.message_id'] = 'fake_message_id' } | ||
modified_config[:notification_payload_transform] = ->(payload) { payload['email.message_id'] = 'fake_message_id' } | ||
instrumentation.instance_variable_set(:@config, modified_config) | ||
|
||
instrumentation.send(:ecs_mail_convention) | ||
payload = { :mailer => "TestMailer"} | ||
payload = { mailer: 'TestMailer' } | ||
|
||
tranformed_payload = instrumentation.config[:notification_payload_transform].call(payload) | ||
|
||
|
@@ -103,7 +102,6 @@ | |
end | ||
|
||
it 'without user-defined payload' do | ||
|
||
tranformed_payload = instrumentation.config[:notification_payload_transform].call(payload) | ||
|
||
_(tranformed_payload['email.message_id']).must_equal '[email protected]' | ||
|