Module: EmailSpec::Matchers

Included in:
Spinach::FeatureSteps
Defined in:
lib/email_spec/matchers.rb

Defined Under Namespace

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


369
370
371
372
373
374
375
# File 'lib/email_spec/matchers.rb', line 369

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


145
146
147
# File 'lib/email_spec/matchers.rb', line 145

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


179
180
181
# File 'lib/email_spec/matchers.rb', line 179

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


109
110
111
# File 'lib/email_spec/matchers.rb', line 109

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


75
76
77
# File 'lib/email_spec/matchers.rb', line 75

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


316
317
318
# File 'lib/email_spec/matchers.rb', line 316

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

#have_header(name, value) ⇒ Object


365
366
367
# File 'lib/email_spec/matchers.rb', line 365

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

#have_subject(subject) ⇒ Object


224
225
226
# File 'lib/email_spec/matchers.rb', line 224

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

#include_email_with_subject(*emails) ⇒ Object


269
270
271
# File 'lib/email_spec/matchers.rb', line 269

def include_email_with_subject(*emails)
  IncludeEmailWithSubject.new(emails.flatten.first)
end

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


39
40
41
# File 'lib/email_spec/matchers.rb', line 39

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