Class: EmailSpec::Matchers::BccTo
- Inherits:
-
Object
- Object
- EmailSpec::Matchers::BccTo
- Defined in:
- lib/email_spec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_email_addresses_or_objects_that_respond_to_email) ⇒ BccTo
constructor
A new instance of BccTo.
- #matches?(email) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected_email_addresses_or_objects_that_respond_to_email) ⇒ BccTo
Returns a new instance of BccTo.
42 43 44 45 46 47 48 |
# File 'lib/email_spec/matchers.rb', line 42 def initialize(expected_email_addresses_or_objects_that_respond_to_email) emails = expected_email_addresses_or_objects_that_respond_to_email.map do |email_or_object| email_or_object.kind_of?(String) ? email_or_object : email_or_object.email end @expected_email_addresses = emails.sort end |
Instance Method Details
#description ⇒ Object
50 51 52 |
# File 'lib/email_spec/matchers.rb', line 50 def description "be bcc'd to #{@expected_email_addresses.inspect}" end |
#failure_message ⇒ Object
60 61 62 |
# File 'lib/email_spec/matchers.rb', line 60 def "expected #{@email.inspect} to bcc to #{@expected_email_addresses.inspect}, but it was bcc'd to #{@actual_recipients.inspect}" end |
#matches?(email) ⇒ Boolean
54 55 56 57 58 |
# File 'lib/email_spec/matchers.rb', line 54 def matches?(email) @email = email @actual_recipients = (email.bcc || []).sort @actual_recipients == @expected_email_addresses end |
#negative_failure_message ⇒ Object
64 65 66 |
# File 'lib/email_spec/matchers.rb', line 64 def "expected #{@email.inspect} not to bcc to #{@expected_email_addresses.inspect}, but it did" end |