Skip to content

Commit 3a6908d

Browse files
committed
Migrate applicable actionmailbox tests to use NotificationAssertions
1 parent 6a62eed commit 3a6908d

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

actionmailbox/test/unit/mailbox/notifications_test.rb

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,20 @@ class RepliesMailbox < ActionMailbox::Base
77

88
class ActionMailbox::Base::NotificationsTest < ActiveSupport::TestCase
99
test "instruments processing" do
10-
events = []
11-
ActiveSupport::Notifications.subscribe("process.action_mailbox") { |event| events << event }
12-
1310
mailbox = RepliesMailbox.new(create_inbound_email_from_fixture("welcome.eml"))
14-
mailbox.perform_processing
11+
expected_payload = {
12+
mailbox:,
13+
inbound_email: {
14+
id: 1,
15+
message_id: "[email protected]",
16+
status: "processing"
17+
}
18+
}
1519

16-
assert_equal 1, events.length
17-
assert_equal "process.action_mailbox", events[0].name
18-
assert_equal(
19-
{
20-
mailbox: mailbox,
21-
inbound_email: {
22-
id: 1,
23-
message_id: "[email protected]",
24-
status: "processing"
25-
}
26-
},
27-
events[0].payload
28-
)
29-
ensure
30-
ActiveSupport::Notifications.unsubscribe("process.action_mailbox")
20+
assert_notifications_count("process.action_mailbox", 1) do
21+
assert_notification("process.action_mailbox", expected_payload) do
22+
mailbox.perform_processing
23+
end
24+
end
3125
end
3226
end

0 commit comments

Comments
 (0)