Commit 50fc6378df6ecb5e41ed862e1e669faa3aa947bc
1 parent
58785a4e
Exists in
master
and in
29 other branches
rails3: fix contact_sender
Showing
2 changed files
with
9 additions
and
9 deletions
Show diff stats
app/mailers/contact.rb
test/unit/contact_sender_test.rb
... | ... | @@ -15,8 +15,8 @@ class ContactSenderTest < ActiveSupport::TestCase |
15 | 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 | - response = Contact::Sender.deliver_mail(c) | |
19 | - assert_equal Environment.default.contact_email, response.from.to_s | |
18 | + response = Contact::Sender.notification(c).deliver | |
19 | + assert_equal Environment.default.contact_email, response.from.first.to_s | |
20 | 20 | assert_equal "[#{ent.name}] #{c.subject}", response.subject |
21 | 21 | end |
22 | 22 | |
... | ... | @@ -24,7 +24,7 @@ class ContactSenderTest < ActiveSupport::TestCase |
24 | 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 | - response = Contact::Sender.deliver_mail(c) | |
27 | + response = Contact::Sender.notification(c).deliver | |
28 | 28 | assert_includes response.to, c.dest.contact_email |
29 | 29 | end |
30 | 30 | |
... | ... | @@ -35,28 +35,28 @@ class ContactSenderTest < ActiveSupport::TestCase |
35 | 35 | ent.add_admin(admin) |
36 | 36 | assert ent.save! |
37 | 37 | c = build(Contact, :dest => ent) |
38 | - response = Contact::Sender.deliver_mail(c) | |
38 | + response = Contact::Sender.notification(c).deliver | |
39 | 39 | assert_includes response.to, admin.email |
40 | 40 | end |
41 | 41 | |
42 | 42 | should 'deliver a copy of email if requester wants' do |
43 | 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 | - response = Contact::Sender.deliver_mail(c) | |
45 | + response = Contact::Sender.notification(c).deliver | |
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 | 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 | - response = Contact::Sender.deliver_mail(c) | |
52 | + response = Contact::Sender.notification(c).deliver | |
53 | 53 | assert_nil response.cc |
54 | 54 | end |
55 | 55 | |
56 | 56 | should 'only deliver mail to email of person' do |
57 | 57 | person = create_user('contacted_user').person |
58 | 58 | c = build(Contact, :dest => person) |
59 | - response = Contact::Sender.deliver_mail(c) | |
59 | + response = Contact::Sender.notification(c).deliver | |
60 | 60 | assert_equal [person.email], response.to |
61 | 61 | end |
62 | 62 | |
... | ... | @@ -64,7 +64,7 @@ class ContactSenderTest < ActiveSupport::TestCase |
64 | 64 | recipient = create_user('contacted_user').person |
65 | 65 | sender = create_user('sender_user').person |
66 | 66 | c = build(Contact, :dest => recipient, :sender => sender) |
67 | - sent_message = Contact::Sender.deliver_mail(c) | |
67 | + sent_message = Contact::Sender.notification(c).deliver | |
68 | 68 | assert_equal 'sender_user', sent_message['X-Noosfero-Sender'].to_s |
69 | 69 | end |
70 | 70 | ... | ... |