Commit 0b4205cedfe41e6ae9058a4601c5a7d6c4bd00c7

Authored by Leandro Santos
1 parent 607be30d

Rails3: Fix ContactSender unit tests partially

Showing 1 changed file with 5 additions and 5 deletions   Show diff stats
test/unit/contact_sender_test.rb
@@ -12,7 +12,7 @@ class ContactSenderTest < ActiveSupport::TestCase @@ -12,7 +12,7 @@ class ContactSenderTest < ActiveSupport::TestCase
12 end 12 end
13 13
14 should 'be able to deliver mail' do 14 should 'be able to deliver mail' do
15 - ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 15 + ent = Environment.default.enterprises.new(:name => 'my enterprise', :identifier => 'myent')
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)
@@ -21,7 +21,7 @@ class ContactSenderTest < ActiveSupport::TestCase @@ -21,7 +21,7 @@ class ContactSenderTest < ActiveSupport::TestCase
21 end 21 end
22 22
23 should 'deliver mail to contact_email' do 23 should 'deliver mail to contact_email' do
24 - ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 24 + ent = Environment.default.enterprises.new(:name => 'my enterprise', :identifier => 'myent')
25 ent.contact_email = 'contact@invalid.com' 25 ent.contact_email = 'contact@invalid.com'
26 c = build(Contact, :dest => ent) 26 c = build(Contact, :dest => ent)
27 response = Contact::Sender.deliver_mail(c) 27 response = Contact::Sender.deliver_mail(c)
@@ -30,7 +30,7 @@ class ContactSenderTest < ActiveSupport::TestCase @@ -30,7 +30,7 @@ class ContactSenderTest < ActiveSupport::TestCase
30 30
31 should 'deliver mail to admins of enterprise' do 31 should 'deliver mail to admins of enterprise' do
32 admin = create_user('admin_test').person 32 admin = create_user('admin_test').person
33 - ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 33 + ent = Environment.default.enterprises.create!(:name => 'my enterprise', :identifier => 'myent')
34 ent.contact_email = 'contact@invalid.com' 34 ent.contact_email = 'contact@invalid.com'
35 ent.add_admin(admin) 35 ent.add_admin(admin)
36 assert ent.save! 36 assert ent.save!
@@ -40,14 +40,14 @@ class ContactSenderTest < ActiveSupport::TestCase @@ -40,14 +40,14 @@ class ContactSenderTest < ActiveSupport::TestCase
40 end 40 end
41 41
42 should 'deliver a copy of email if requester wants' do 42 should 'deliver a copy of email if requester wants' do
43 - ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 43 + ent = Environment.default.enterprises.new(:name => 'my enterprise', :identifier => 'myent')
44 c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => true) 44 c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => true)
45 response = Contact::Sender.deliver_mail(c) 45 response = Contact::Sender.deliver_mail(c)
46 assert_includes response.cc, c.email 46 assert_includes response.cc, c.email
47 end 47 end
48 48
49 should 'not deliver a copy of email if requester dont wants' do 49 should 'not deliver a copy of email if requester dont wants' do
50 - ent = Enterprise.new(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) 50 + ent = Environment.default.enterprises.new(:name => 'my enterprise', :identifier => 'myent')
51 c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => false) 51 c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => false)
52 response = Contact::Sender.deliver_mail(c) 52 response = Contact::Sender.deliver_mail(c)
53 assert_nil response.cc 53 assert_nil response.cc