Class: EmailSpec::Matchers::ReplyTo
- Inherits:
-
Object
- Object
- EmailSpec::Matchers::ReplyTo
- Defined in:
- lib/email_spec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(email) ⇒ ReplyTo
constructor
A new instance of ReplyTo.
- #matches?(email) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(email) ⇒ ReplyTo
Returns a new instance of ReplyTo.
4 5 6 |
# File 'lib/email_spec/matchers.rb', line 4 def initialize(email) @expected_reply_to = TMail::Address.parse(email) end |
Instance Method Details
#description ⇒ Object
8 9 10 |
# File 'lib/email_spec/matchers.rb', line 8 def description "have reply to as #{@expected_reply_to.address.to_s}" end |
#failure_message ⇒ Object
19 20 21 |
# File 'lib/email_spec/matchers.rb', line 19 def "expected #{@email.inspect} to reply to #{@expected_reply_to.address.inspect}, but it replied to #{@actual_reply_to.inspect}" end |
#matches?(email) ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/email_spec/matchers.rb', line 12 def matches?(email) @email = email @actual_reply_to = (email.reply_to || []).first !@actual_reply_to.nil? && @actual_reply_to == @expected_reply_to.address end |
#negative_failure_message ⇒ Object
23 24 25 |
# File 'lib/email_spec/matchers.rb', line 23 def "expected #{@email.inspect} not to deliver to #{@expected_reply_to.inspect}, but it did" end |