Commit 5c2a498716fcaaf37bc892103225b72f611d25e8
1 parent
c19a7b46
Exists in
master
and in
29 other branches
noreply-email: fix tests related to noreply changes
Showing
3 changed files
with
10 additions
and
7 deletions
Show diff stats
test/unit/contact_sender_test.rb
@@ -16,7 +16,7 @@ class ContactSenderTest < ActiveSupport::TestCase | @@ -16,7 +16,7 @@ class ContactSenderTest < ActiveSupport::TestCase | ||
16 | ent.contact_email = 'contact@invalid.com' | 16 | ent.contact_email = 'contact@invalid.com' |
17 | c = build(Contact, :dest => ent) | 17 | c = build(Contact, :dest => ent) |
18 | response = Contact::Sender.deliver_mail(c) | 18 | response = Contact::Sender.deliver_mail(c) |
19 | - assert_equal Environment.default.noreply_email, response.from.to_s | 19 | + assert_equal Environment.default.noreply_email.to_s, response.from.to_s |
20 | assert_equal "[#{ent.name}] #{c.subject}", response.subject | 20 | assert_equal "[#{ent.name}] #{c.subject}", response.subject |
21 | end | 21 | end |
22 | 22 |
test/unit/contact_test.rb
@@ -46,6 +46,9 @@ class ContactTest < ActiveSupport::TestCase | @@ -46,6 +46,9 @@ class ContactTest < ActiveSupport::TestCase | ||
46 | 46 | ||
47 | should 'use sender name and environment noreply_email on from' do | 47 | should 'use sender name and environment noreply_email on from' do |
48 | ent = fast_create(Enterprise, :name => 'my enterprise', :identifier => 'myent') | 48 | ent = fast_create(Enterprise, :name => 'my enterprise', :identifier => 'myent') |
49 | + env = ent.environment | ||
50 | + env.noreply_email = 'noreply@sample.org' | ||
51 | + env.save! | ||
49 | c = Contact.new(:name => 'john', :email => 'john@invalid.com', :subject => 'hi', :message => 'hi, all', :dest => ent) | 52 | c = Contact.new(:name => 'john', :email => 'john@invalid.com', :subject => 'hi', :message => 'hi, all', :dest => ent) |
50 | email = c.deliver | 53 | email = c.deliver |
51 | assert_equal "#{c.name} <#{ent.environment.noreply_email}>", email['from'].to_s | 54 | assert_equal "#{c.name} <#{ent.environment.noreply_email}>", email['from'].to_s |
test/unit/task_mailer_test.rb
@@ -24,7 +24,7 @@ class TaskMailerTest < ActiveSupport::TestCase | @@ -24,7 +24,7 @@ class TaskMailerTest < ActiveSupport::TestCase | ||
24 | requestor.expects(:name).returns('my name') | 24 | requestor.expects(:name).returns('my name') |
25 | 25 | ||
26 | environment = mock() | 26 | environment = mock() |
27 | - environment.expects(:contact_email).returns('sender@example.com') | 27 | + environment.expects(:noreply_email).returns('sender@example.com') |
28 | environment.expects(:default_hostname).returns('example.com') | 28 | environment.expects(:default_hostname).returns('example.com') |
29 | environment.expects(:name).returns('example').at_least_once | 29 | environment.expects(:name).returns('example').at_least_once |
30 | 30 | ||
@@ -47,7 +47,7 @@ class TaskMailerTest < ActiveSupport::TestCase | @@ -47,7 +47,7 @@ class TaskMailerTest < ActiveSupport::TestCase | ||
47 | requestor.expects(:name).returns('my name') | 47 | requestor.expects(:name).returns('my name') |
48 | 48 | ||
49 | environment = mock() | 49 | environment = mock() |
50 | - environment.expects(:contact_email).returns('sender@example.com') | 50 | + environment.expects(:noreply_email).returns('sender@example.com') |
51 | environment.expects(:default_hostname).returns('example.com') | 51 | environment.expects(:default_hostname).returns('example.com') |
52 | environment.expects(:name).returns('example').at_least_once | 52 | environment.expects(:name).returns('example').at_least_once |
53 | 53 | ||
@@ -71,7 +71,7 @@ class TaskMailerTest < ActiveSupport::TestCase | @@ -71,7 +71,7 @@ class TaskMailerTest < ActiveSupport::TestCase | ||
71 | requestor.expects(:name).returns('my name') | 71 | requestor.expects(:name).returns('my name') |
72 | 72 | ||
73 | environment = mock() | 73 | environment = mock() |
74 | - environment.expects(:contact_email).returns('sender@example.com') | 74 | + environment.expects(:noreply_email).returns('sender@example.com') |
75 | environment.expects(:default_hostname).returns('example.com') | 75 | environment.expects(:default_hostname).returns('example.com') |
76 | environment.expects(:name).returns('example').at_least_once | 76 | environment.expects(:name).returns('example').at_least_once |
77 | 77 | ||
@@ -105,7 +105,7 @@ class TaskMailerTest < ActiveSupport::TestCase | @@ -105,7 +105,7 @@ class TaskMailerTest < ActiveSupport::TestCase | ||
105 | requestor.stubs(:public_profile_url).returns('requestor_path') | 105 | requestor.stubs(:public_profile_url).returns('requestor_path') |
106 | 106 | ||
107 | environment = mock() | 107 | environment = mock() |
108 | - environment.expects(:contact_email).returns('sender@example.com') | 108 | + environment.expects(:noreply_email).returns('sender@example.com') |
109 | environment.expects(:default_hostname).returns('example.com') | 109 | environment.expects(:default_hostname).returns('example.com') |
110 | environment.expects(:name).returns('example').at_least_once | 110 | environment.expects(:name).returns('example').at_least_once |
111 | 111 | ||
@@ -124,11 +124,11 @@ class TaskMailerTest < ActiveSupport::TestCase | @@ -124,11 +124,11 @@ class TaskMailerTest < ActiveSupport::TestCase | ||
124 | assert !ActionMailer::Base.deliveries.empty? | 124 | assert !ActionMailer::Base.deliveries.empty? |
125 | end | 125 | end |
126 | 126 | ||
127 | - should 'use environment name and contact email' do | 127 | + should 'use environment name and no-reply email' do |
128 | task = mock | 128 | task = mock |
129 | environment = mock | 129 | environment = mock |
130 | environment.expects(:name).returns('My name') | 130 | environment.expects(:name).returns('My name') |
131 | - environment.expects(:contact_email).returns('email@example.com') | 131 | + environment.expects(:noreply_email).returns('email@example.com') |
132 | 132 | ||
133 | task.expects(:environment).returns(environment).at_least_once | 133 | task.expects(:environment).returns(environment).at_least_once |
134 | 134 |