Module: EmailSpec::Matchers

Defined in:
lib/email_spec/matchers.rb

Defined Under Namespace

Classes: BccTo, CcTo, DeliverFrom, DeliverTo, HaveBodyText, HaveHeader, HaveSubject, IncludeEmailWithSubject, ReplyTo

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



349
350
351
352
353
354
355
# File 'lib/email_spec/matchers.rb', line 349

def self.included base
  if base.respond_to? :register_matcher
    instance_methods.each do |name|
      base.register_matcher name, name
    end
  end
end

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

#have_body_text(text) ⇒ Object



297
298
299
# File 'lib/email_spec/matchers.rb', line 297

def have_body_text(text)
  HaveBodyText.new(text)
end

#have_header(name, value) ⇒ Object



345
346
347
# File 'lib/email_spec/matchers.rb', line 345

def have_header(name, value)
  HaveHeader.new(name, value)
end

#have_subject(subject) ⇒ Object



207
208
209
# File 'lib/email_spec/matchers.rb', line 207

def have_subject(subject)
  HaveSubject.new(subject)
end

#include_email_with_subject(*emails) ⇒ Object



251
252
253
# File 'lib/email_spec/matchers.rb', line 251

def include_email_with_subject(*emails)
  IncludeEmailWithSubject.new(emails.flatten.first)
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