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

View File

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