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



389
390
391
392
393
394
395
# File 'lib/email_spec/matchers.rb', line 389

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



147
148
149
# File 'lib/email_spec/matchers.rb', line 147

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



181
182
183
# File 'lib/email_spec/matchers.rb', line 181

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



111
112
113
# File 'lib/email_spec/matchers.rb', line 111

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



77
78
79
# File 'lib/email_spec/matchers.rb', line 77

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



329
330
331
# File 'lib/email_spec/matchers.rb', line 329

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

#have_header(name, value) ⇒ Object



385
386
387
# File 'lib/email_spec/matchers.rb', line 385

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

#have_subject(subject) ⇒ Object



226
227
228
# File 'lib/email_spec/matchers.rb', line 226

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

#include_email_with_subject(*emails) ⇒ Object



271
272
273
# File 'lib/email_spec/matchers.rb', line 271

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

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



41
42
43
# File 'lib/email_spec/matchers.rb', line 41

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