Class: Tape::EmailSpec::Matchers::CcTo
- Inherits:
-
Object
- Object
- Tape::EmailSpec::Matchers::CcTo
- Defined in:
- lib/tape/email_spec/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_email_addresses_or_objects_that_respond_to_email) ⇒ CcTo
constructor
A new instance of CcTo.
- #matches?(email) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected_email_addresses_or_objects_that_respond_to_email) ⇒ CcTo
Returns a new instance of CcTo.
137 138 139 140 141 142 143 |
# File 'lib/tape/email_spec/matchers.rb', line 137 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
145 146 147 |
# File 'lib/tape/email_spec/matchers.rb', line 145 def description "be cc'd to #{@expected_email_addresses.inspect}" end |
#failure_message ⇒ Object
155 156 157 |
# File 'lib/tape/email_spec/matchers.rb', line 155 def "expected #{@email.inspect} to cc to #{@expected_email_addresses.inspect}, but it was cc'd to #{@actual_recipients.inspect}" end |
#matches?(email) ⇒ Boolean
149 150 151 152 153 |
# File 'lib/tape/email_spec/matchers.rb', line 149 def matches?(email) @email = email @actual_recipients = (Array(email.cc) || []).sort @actual_recipients == @expected_email_addresses end |
#negative_failure_message ⇒ Object
159 160 161 |
# File 'lib/tape/email_spec/matchers.rb', line 159 def "expected #{@email.inspect} not to cc to #{@expected_email_addresses.inspect}, but it did" end |