Tests updated for the new organisation mails

This commit is contained in:
echarp 2016-10-31 22:41:20 +01:00
parent 786eb5ee2a
commit 60e641ac91
2 changed files with 8 additions and 8 deletions

View File

@ -43,6 +43,8 @@ class Orga < ActiveRecord::Base
after_create do
send_secret unless submitter.blank?
# Send email to moderators when an new orga is received
ModerationorgaMailer.create(self).deliver_now!
end
after_update do
@ -69,8 +71,6 @@ class Orga < ActiveRecord::Base
def send_secret
OrgaMailer.create(self).deliver_now!
# Send email to moderators when an new orga is received
ModerationorgaMailer.create(self).deliver_now!
end
def name_as_tag

View File

@ -9,7 +9,7 @@ class OrgaTest < ActiveSupport::TestCase
end
test 'propose orga' do
assert_difference 'ActionMailer::Base.deliveries.size', 1 do
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
Orga.create!(
kind: Kind.first,
name: 'Tested organisation',
@ -20,7 +20,7 @@ class OrgaTest < ActiveSupport::TestCase
)
end
assert_no_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'ActionMailer::Base.deliveries.size', 1 do
Orga.create!(
kind: Kind.first,
name: 'Tested organisation',
@ -34,7 +34,7 @@ class OrgaTest < ActiveSupport::TestCase
test 'set and send secret' do
@orga = orgas(:two)
assert_nil @orga.secret
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
assert_difference 'ActionMailer::Base.deliveries.size', 3 do
@orga.name = 'hop hop hop'
@orga.save!
end
@ -43,7 +43,7 @@ class OrgaTest < ActiveSupport::TestCase
test 'edit orga' do
@orga = orgas(:one)
assert_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
@orga.name += ' addition added as an edit :)'
@orga.save!
end
@ -51,7 +51,7 @@ class OrgaTest < ActiveSupport::TestCase
test 'accept orga' do
@orga = orgas(:two)
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
assert_difference 'ActionMailer::Base.deliveries.size', 3 do
@orga.moderated = true
@orga.save!
end
@ -59,7 +59,7 @@ class OrgaTest < ActiveSupport::TestCase
test 'refuse orga' do
@orga = orgas(:two)
assert_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
@orga.destroy!
end
end