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
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(email) ⇒ ReplyTo
constructor
A new instance of ReplyTo.
- #matches?(email) ⇒ Boolean
Constructor Details
#initialize(email) ⇒ ReplyTo
Returns a new instance of ReplyTo.
16 17 18 |
# File 'lib/email_spec/matchers.rb', line 16 def initialize(email) @expected_reply_to = Mail::ReplyToField.new(email).addrs.first end |
Instance Method Details
#description ⇒ Object
20 21 22 |
# File 'lib/email_spec/matchers.rb', line 20 def description "have reply to as #{@expected_reply_to.address}" end |
#failure_message ⇒ Object
31 32 33 |
# File 'lib/email_spec/matchers.rb', line 31 def "expected #{@email.inspect} to reply to #{@expected_reply_to.address.inspect}, but it replied to #{@actual_reply_to.inspect}" end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
35 36 37 |
# File 'lib/email_spec/matchers.rb', line 35 def "expected #{@email.inspect} not to deliver to #{@expected_reply_to.address.inspect}, but it did" end |
#matches?(email) ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/email_spec/matchers.rb', line 24 def matches?(email) @email = email @actual_reply_to = (email.reply_to || []).first !@actual_reply_to.nil? && @actual_reply_to == @expected_reply_to.address end |