2013-12-28 15:45:21 +01:00
|
|
|
require 'test_helper'
|
|
|
|
|
2015-07-25 18:32:27 +02:00
|
|
|
# Verify the organisation creatino and mail workflow
|
2015-02-15 17:10:17 +01:00
|
|
|
class OrgaTest < ActiveSupport::TestCase
|
2015-07-25 18:32:27 +02:00
|
|
|
setup do
|
|
|
|
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
|
|
|
|
|
|
|
@config = Rails.application.config
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'propose orga' do
|
|
|
|
assert_difference 'ActionMailer::Base.deliveries.size', 1 do
|
|
|
|
Orga.create!(
|
|
|
|
kind: Kind.first,
|
|
|
|
name: 'Tested organisation',
|
|
|
|
url: 'http://example.com',
|
|
|
|
region: Region.first,
|
|
|
|
contact: 'contact@example.com'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'set and send secret' do
|
|
|
|
@orga = orgas(:two)
|
|
|
|
assert_nil @orga.secret
|
|
|
|
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
|
|
|
|
@orga.name = 'hop hop hop'
|
|
|
|
@orga.save!
|
|
|
|
end
|
|
|
|
assert_not_nil @orga.secret
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'edit orga' do
|
|
|
|
@orga = orgas(:one)
|
|
|
|
assert_difference 'ActionMailer::Base.deliveries.size' do
|
|
|
|
@orga.name += ' addition added as an edit :)'
|
|
|
|
@orga.save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'accept orga' do
|
|
|
|
@orga = orgas(:two)
|
|
|
|
assert_difference 'ActionMailer::Base.deliveries.size', 2 do
|
|
|
|
@orga.moderated = true
|
|
|
|
@orga.save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'refuse orga' do
|
|
|
|
@orga = orgas(:two)
|
|
|
|
assert_difference 'ActionMailer::Base.deliveries.size' do
|
|
|
|
@orga.destroy!
|
|
|
|
end
|
|
|
|
end
|
2013-12-28 15:45:21 +01:00
|
|
|
end
|