Module: EmailSpec::Matchers

Defined in:
lib/email_spec/matchers.rb

Defined Under Namespace

Classes: BccTo, CcTo, DeliverFrom, DeliverTo, ReplyTo

Instance Method Summary collapse

Instance Method Details

#bcc_to(*expected_email_addresses_or_objects_that_respond_to_email) ⇒ Object



130
131
132
# File 'lib/email_spec/matchers.rb', line 130

def bcc_to(*expected_email_addresses_or_objects_that_respond_to_email)
  BccTo.new(expected_email_addresses_or_objects_that_respond_to_email.flatten)
end

#cc_to(*expected_email_addresses_or_objects_that_respond_to_email) ⇒ Object



163
164
165
# File 'lib/email_spec/matchers.rb', line 163

def cc_to(*expected_email_addresses_or_objects_that_respond_to_email)
  CcTo.new(expected_email_addresses_or_objects_that_respond_to_email.flatten)
end

#deliver_from(email) ⇒ Object Also known as: be_delivered_from



95
96
97
# File 'lib/email_spec/matchers.rb', line 95

def deliver_from(email)
  DeliverFrom.new(email)
end

#deliver_to(*expected_email_addresses_or_objects_that_respond_to_email) ⇒ Object Also known as: be_delivered_to



62
63
64
# File 'lib/email_spec/matchers.rb', line 62

def deliver_to(*expected_email_addresses_or_objects_that_respond_to_email)
  DeliverTo.new(expected_email_addresses_or_objects_that_respond_to_email.flatten)
end

#mail_headers_hash(email_headers) ⇒ Object



231
232
233
# File 'lib/email_spec/matchers.rb', line 231

def mail_headers_hash(email_headers)
  email_headers.fields.inject({}) { |hash, field| hash[field.field.class::FIELD_NAME] = field.to_s; hash }
end

#reply_to(email) ⇒ Object Also known as: have_reply_to



28
29
30
# File 'lib/email_spec/matchers.rb', line 28

def reply_to(email)
  ReplyTo.new(email)
end