Correction, so that we can still edit an orga, even if it has no submitter

This commit is contained in:
echarp 2017-07-02 12:16:53 +02:00
parent 7dd9d65ea9
commit 7afa2951d0
2 changed files with 17 additions and 1 deletions

View File

@ -43,7 +43,7 @@ class Orga < ApplicationRecord
end
after_create do
send_secret
send_secret if submitter.present?
# Send email to moderators when an new orga is received
ModerationorgaMailer.create(self).deliver_now!
end

View File

@ -40,6 +40,22 @@ class OrgasControllerTest < ActionController::TestCase
assert_redirected_to :root
end
test 'should create minimalist orga' do
sign_in users(:one)
assert_difference 'Orga.count' do
post :create, orga: {
kind_id: @orga.kind_id,
name: @orga.name,
region_id: @orga.region.id,
url: @orga.url
}
assert_empty assigns(:orga).errors.messages
end
assert_redirected_to :root
end
test 'should not create orga' do
sign_in users(:one)
assert_no_difference 'Orga.count' do