Module: CodyRobbins::EmailTestHelpers::Matchers
- Defined in:
- lib/cody_robbins/email_test_helpers/matchers.rb
Instance Method Summary collapse
-
#be_sent_from(name, address) ⇒ RSpec::Matchers::Matcher
Verifies both the address and display name an email is sent from.
-
#be_sent_from_address(address) ⇒ RSpec::Matchers::Matcher
Verifies the address an email is sent from.
-
#be_sent_from_display_name(name) ⇒ RSpec::Matchers::Matcher
Verifies the display name an email is sent from.
-
#be_sent_to(address) ⇒ RSpec::Matchers::Matcher
Verifies the address an email is sent to.
Instance Method Details
#be_sent_from(name, address) ⇒ RSpec::Matchers::Matcher
Verifies both the address and display name an email is sent from. This just combines the be_sent_from_address
and be_sent_from_display_name
matchers.
63 64 65 66 67 68 |
# File 'lib/cody_robbins/email_test_helpers/matchers.rb', line 63 RSpec::Matchers.define(:be_sent_from) do |name, address| match do |mail| mail.should be_sent_from_display_name name mail.should be_sent_from_address address end end |
#be_sent_from_address(address) ⇒ RSpec::Matchers::Matcher
Verifies the address an email is sent from.
30 31 32 33 34 |
# File 'lib/cody_robbins/email_test_helpers/matchers.rb', line 30 RSpec::Matchers.define(:be_sent_from_address) do |address| match do |mail| mail.from.should == [address] end end |
#be_sent_from_display_name(name) ⇒ RSpec::Matchers::Matcher
Verifies the display name an email is sent from. The display name is the optional text outside the angle brackets in a From
header such as Dagny Taggart <[email protected]>
.
46 47 48 49 50 |
# File 'lib/cody_robbins/email_test_helpers/matchers.rb', line 46 RSpec::Matchers.define(:be_sent_from_display_name) do |name| match do |mail| mail[:from].display_names.should == [name] end end |
#be_sent_to(address) ⇒ RSpec::Matchers::Matcher
Verifies the address an email is sent to.
14 15 16 17 18 |
# File 'lib/cody_robbins/email_test_helpers/matchers.rb', line 14 RSpec::Matchers.define(:be_sent_to) do |address| match do |mail| mail.to.should == [address] end end |