Module: EmailSpec::Matchers

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



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

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



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

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



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

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



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

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



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

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



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

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

#have_header(name, value) ⇒ Object



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

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

#have_subject(subject) ⇒ Object



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

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

#include_email_with_subject(*emails) ⇒ Object



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

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