Correction, so that we can still edit an orga, even if it has no submitter
This commit is contained in:
parent
7dd9d65ea9
commit
7afa2951d0
|
@ -43,7 +43,7 @@ class Orga < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
after_create do
|
after_create do
|
||||||
send_secret
|
send_secret if submitter.present?
|
||||||
# Send email to moderators when an new orga is received
|
# Send email to moderators when an new orga is received
|
||||||
ModerationorgaMailer.create(self).deliver_now!
|
ModerationorgaMailer.create(self).deliver_now!
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,6 +40,22 @@ class OrgasControllerTest < ActionController::TestCase
|
||||||
assert_redirected_to :root
|
assert_redirected_to :root
|
||||||
end
|
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
|
test 'should not create orga' do
|
||||||
sign_in users(:one)
|
sign_in users(:one)
|
||||||
assert_no_difference 'Orga.count' do
|
assert_no_difference 'Orga.count' do
|
||||||
|
|
Loading…
Reference in New Issue