File tree Expand file tree Collapse file tree 1 file changed +13
-19
lines changed
actionmailbox/test/unit/mailbox Expand file tree Collapse file tree 1 file changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -7,26 +7,20 @@ class RepliesMailbox < ActionMailbox::Base
7
7
8
8
class ActionMailbox ::Base ::NotificationsTest < ActiveSupport ::TestCase
9
9
test "instruments processing" do
10
- events = [ ]
11
- ActiveSupport ::Notifications . subscribe ( "process.action_mailbox" ) { |event | events << event }
12
-
13
10
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
+
16
+ status : "processing"
17
+ }
18
+ }
15
19
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
-
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
31
25
end
32
26
end
You can’t perform that action at this time.
0 commit comments