Sha256: 043f9f1412a2ab088eb3c69584c991786a2990d17c60949a81a7e750110c56f4

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'rspec/expectations'

RSpec::Matchers.define :be_to do |*expected|
  match do |actual|
    expected.all? { |e| actual.to.include?(e) }
  end

  failure_message do |actual|
    "To: #{actual.to.join(', ')} should include #{expected.join(' and ')}"
  end
end

RSpec::Matchers.define :be_from do |*expected|
  match do |actual|
    expected.all? { |e| actual.from.include?(e) }
  end

  failure_message do |actual|
    "From: #{actual.from.join(', ')} should include #{expected.join(' and ')}"
  end
end

RSpec::Matchers.define :be_cc_to do |*expected|
  match do |actual|
    expected.all? { |e| actual.cc.include?(e) }
  end

  failure_message do |actual|
    "Cc: #{actual.cc.join(', ')} should include #{expected.join(' and ')}"
  end
end

RSpec::Matchers.define :be_cc_to do |*expected|
  match do |actual|
    expected.all? { |e| actual.bcc.include?(e) }
  end

  failure_message do |actual|
    "Cc: #{actual.bcc.join(', ')} should include #{expected.join(' and ')}"
  end
end


RSpec::Matchers.define :have_text_body do |expected|
  match do |actual|
    actual.text_part.body == expected
  end
end

RSpec::Matchers.define :have_html_body do |expected|
  match do |actual|
    actual.html_part.body == expected
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-mail-matchers-0.0.1 lib/rspec-mail-matchers.rb