Commit 0b4205cedfe41e6ae9058a4601c5a7d6c4bd00c7
1 parent
607be30d
Exists in
staging
and in
42 other branches
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 | 12 | end |
| 13 | 13 | |
| 14 | 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 | 16 | ent.contact_email = 'contact@invalid.com' |
| 17 | 17 | c = build(Contact, :dest => ent) |
| 18 | 18 | response = Contact::Sender.deliver_mail(c) |
| ... | ... | @@ -21,7 +21,7 @@ class ContactSenderTest < ActiveSupport::TestCase |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | 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 | 25 | ent.contact_email = 'contact@invalid.com' |
| 26 | 26 | c = build(Contact, :dest => ent) |
| 27 | 27 | response = Contact::Sender.deliver_mail(c) |
| ... | ... | @@ -30,7 +30,7 @@ class ContactSenderTest < ActiveSupport::TestCase |
| 30 | 30 | |
| 31 | 31 | should 'deliver mail to admins of enterprise' do |
| 32 | 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 | 34 | ent.contact_email = 'contact@invalid.com' |
| 35 | 35 | ent.add_admin(admin) |
| 36 | 36 | assert ent.save! |
| ... | ... | @@ -40,14 +40,14 @@ class ContactSenderTest < ActiveSupport::TestCase |
| 40 | 40 | end |
| 41 | 41 | |
| 42 | 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 | 44 | c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => true) |
| 45 | 45 | response = Contact::Sender.deliver_mail(c) |
| 46 | 46 | assert_includes response.cc, c.email |
| 47 | 47 | end |
| 48 | 48 | |
| 49 | 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 | 51 | c = build(Contact, :dest => ent, :email => 'requester@invalid.com', :receive_a_copy => false) |
| 52 | 52 | response = Contact::Sender.deliver_mail(c) |
| 53 | 53 | assert_nil response.cc | ... | ... |