File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,20 @@ def initialize(message)
22
22
@inbound_email = create_inbound_email ( message )
23
23
end
24
24
25
- def matches? ( mailbox )
26
- @mailbox = mailbox
27
- @receiver = ApplicationMailbox . router . send ( :match_to_mailbox , inbound_email )
25
+ if defined? ( ::ApplicationMailbox ) && ::ApplicationMailbox . router . respond_to? ( :mailbox_for )
26
+ def matches? ( mailbox )
27
+ @mailbox = mailbox
28
+ @receiver = ApplicationMailbox . router . mailbox_for ( inbound_email )
28
29
29
- @receiver == @mailbox
30
+ @receiver == @mailbox
31
+ end
32
+ else
33
+ def matches? ( mailbox )
34
+ @mailbox = mailbox
35
+ @receiver = ApplicationMailbox . router . send ( :match_to_mailbox , inbound_email )
36
+
37
+ @receiver == @mailbox
38
+ end
30
39
end
31
40
32
41
def failure_message
@@ -41,7 +50,7 @@ def failure_message_when_negated
41
50
"expected #{ describe_inbound_email } not to route to #{ mailbox } "
42
51
end
43
52
44
- private
53
+ private
45
54
46
55
attr_reader :inbound_email , :mailbox , :receiver
47
56
You can’t perform that action at this time.
0 commit comments