From 5179843f9f9b7787a0f80c9f9c49437ffa45ca0c Mon Sep 17 00:00:00 2001 From: Vincent Oord Date: Thu, 28 Jul 2016 13:00:36 +0200 Subject: [PATCH 1/2] Use example.com domain for default dummy_recipient. Fixes #24 --- README.rdoc | 4 ++-- lib/send_grid/config.rb | 2 +- spec/mailer_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rdoc b/README.rdoc index e7806d0..d66567a 100644 --- a/README.rdoc +++ b/README.rdoc @@ -49,7 +49,7 @@ If you use Heroku, here what the mailer initializer may look like: === Overriding default recipient in standard SMTP header Dummy recipient email used in sent email's "To" header and seen in received email's Received header. -By default set to 'dummy@email.com' +By default set to 'dummy@example.com' In config/initializers/mail.rb: @@ -146,7 +146,7 @@ Add an invisible image at the end of the email to track e-mail opens. If the ema *v2.0.1* -* Standard SMTP To attribute set to 'dummy@email.com' after recipients added to X-SMTPAPI header +* Standard SMTP To attribute set to 'dummy@example.com' after recipients added to X-SMTPAPI header *v2.0* diff --git a/lib/send_grid/config.rb b/lib/send_grid/config.rb index 09aece9..d0f29a7 100644 --- a/lib/send_grid/config.rb +++ b/lib/send_grid/config.rb @@ -2,6 +2,6 @@ class SendGrid::Config attr_accessor :dummy_recipient def initialize - @dummy_recipient = "dummy@email.com" + @dummy_recipient = "dummy@example.com" end end diff --git a/spec/mailer_spec.rb b/spec/mailer_spec.rb index 4e3717f..707518b 100644 --- a/spec/mailer_spec.rb +++ b/spec/mailer_spec.rb @@ -45,10 +45,10 @@ describe 'dummy_recipient used in TO is taken from config' do it 'should be used in TO default dummy_recipient' do - # by defaut dummy_recipient's email is dummy@email.com + # by defaut dummy_recipient's email is dummy@example.com Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s. - should include('To: dummy@email.com') + should include('To: dummy@example.com') end it 'should be used in To defined in config dummy_recipient' do From c7d200ac4b8e906b1771d6f70f6ff928d2d10b34 Mon Sep 17 00:00:00 2001 From: Vincent Oord Date: Thu, 28 Jul 2016 13:02:27 +0200 Subject: [PATCH 2/2] Use example.com domain everywhere --- README.rdoc | 8 ++++---- spec/api_header_spec.rb | 9 ++++----- spec/fixtures/mailers/mailer.rb | 3 +-- spec/mailer_spec.rb | 16 ++++++++-------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.rdoc b/README.rdoc index d66567a..bc278dd 100644 --- a/README.rdoc +++ b/README.rdoc @@ -66,7 +66,7 @@ In config/initializers/mail.rb: :subject => 'An email sent via SendGrid' def email_with_multiple_recipients - mail :to => %w(email1@email.com email2@email.com) + mail :to => %w(email1@example.com email2@example.com) end end @@ -81,7 +81,7 @@ Mailer class definition: def email_with_substitutions substitute '-user_name-', %w(User1 User2) - mail :to => %w(email1@email.com email2@email.com), :body => "Hello, -user_name-!" + mail :to => %w(email1@example.com email2@example.com), :body => "Hello, -user_name-!" end end @@ -95,7 +95,7 @@ Mailer class definition: def email_with_category category 'SendGridRocks' - mail :to => 'email1@email.com' + mail :to => 'email1@example.com' end end @@ -113,7 +113,7 @@ Add an invisible image at the end of the email to track e-mail opens. If the ema def email_with_open_tracking_enabled open_tracking true - mail :to => 'email@email.com' + mail :to => 'email@example.com' end end diff --git a/spec/api_header_spec.rb b/spec/api_header_spec.rb index 20daaf9..cc20c1b 100644 --- a/spec/api_header_spec.rb +++ b/spec/api_header_spec.rb @@ -8,13 +8,13 @@ end it "contains 1 recipient (as array)" do - header.add_recipients 'email@email.com' - header.to_json.should eql '{"to":[ "email@email.com" ]}' + header.add_recipients 'email@example.com' + header.to_json.should eql '{"to":[ "email@example.com" ]}' end it "contaions an array of recipients" do - header.add_recipients %w(email1@email.com email2@email.com) - header.to_json.should eql '{"to":[ "email1@email.com", "email2@email.com" ]}' + header.add_recipients %w(email1@example.com email2@example.com) + header.to_json.should eql '{"to":[ "email1@example.com", "email2@example.com" ]}' end it "contains substitution" do @@ -49,4 +49,3 @@ end end end - diff --git a/spec/fixtures/mailers/mailer.rb b/spec/fixtures/mailers/mailer.rb index e02fbf9..0d3742a 100644 --- a/spec/fixtures/mailers/mailer.rb +++ b/spec/fixtures/mailers/mailer.rb @@ -12,7 +12,6 @@ def email_with_cc_recipients(recipients, cc, bcc) def email_open_tracking(opentrack_enabled = true) open_tracking opentrack_enabled - mail :to => 'email@email.com', :body => 'Hello!' + mail :to => 'email@example.com', :body => 'Hello!' end end - diff --git a/spec/mailer_spec.rb b/spec/mailer_spec.rb index 707518b..5dd7401 100644 --- a/spec/mailer_spec.rb +++ b/spec/mailer_spec.rb @@ -3,16 +3,16 @@ describe Mailer do describe 'email with multiple recipients' do it 'set correct recipients in X-SMTAPI header' do - Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s. - should include('X-SMTPAPI: {"to":[ "em1@email.com", "em2@email.com" ]}') + Mailer.email_with_multiple_recipients(%w(em1@example.com em2@example.com)).deliver.header.to_s. + should include('X-SMTPAPI: {"to":[ "em1@example.com", "em2@example.com" ]}') - Mailer.email_with_cc_recipients(%w(em1@email.com), %w(cc@email.com), %w(bcc@email.com)).deliver.header.to_s. - should include('X-SMTPAPI: {"to":[ "em1@email.com", "cc@email.com", "bcc@email.com" ]}') + Mailer.email_with_cc_recipients(%w(em1@example.com), %w(cc@example.com), %w(bcc@example.com)).deliver.header.to_s. + should include('X-SMTPAPI: {"to":[ "em1@example.com", "cc@example.com", "bcc@example.com" ]}') end it 'removes original TO header part' do - Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s. - should_not include("To: em1@email.com") + Mailer.email_with_multiple_recipients(%w(em1@example.com em2@example.com)).deliver.header.to_s. + should_not include("To: em1@example.com") end it 'maintains recommended header line length' do @@ -47,7 +47,7 @@ it 'should be used in TO default dummy_recipient' do # by defaut dummy_recipient's email is dummy@example.com - Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s. + Mailer.email_with_multiple_recipients(%w(em1@example.com em2@example.com)).deliver.header.to_s. should include('To: dummy@example.com') end @@ -58,7 +58,7 @@ config.dummy_recipient = 'noreply@example.com' end - Mailer.email_with_multiple_recipients(%w(em1@email.com em2@email.com)).deliver.header.to_s. + Mailer.email_with_multiple_recipients(%w(em1@example.com em2@example.com)).deliver.header.to_s. should include('To: noreply@example.com') end end