mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Tests for Admin::Targets controller
Authorization in index action is not needed. Fix failed delete flash error message.
This commit is contained in:
parent
680d23a64a
commit
c219ffc9a3
2 changed files with 172 additions and 6 deletions
|
|
@ -3,9 +3,7 @@ module Admin
|
|||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :target, through: :conference
|
||||
|
||||
def index
|
||||
authorize! :update, Target.new(conference_id: @conference.id)
|
||||
end
|
||||
def index; end
|
||||
|
||||
def new
|
||||
@target = @conference.targets.new
|
||||
|
|
@ -39,9 +37,9 @@ module Admin
|
|||
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
|
||||
notice: 'Target successfully destroyed.')
|
||||
else
|
||||
redirect_to(admin_conference_targets_path(conference_id: @conference.short_title),
|
||||
error: 'Target was successfully destroyed.' \
|
||||
"#{@target.errors.full_messages.join('. ')}.")
|
||||
redirect_to admin_conference_targets_path(conference_id: @conference.short_title),
|
||||
flash: { error: "Could not delete target for #{@conference.title}: "\
|
||||
"#{@target.errors.full_messages.join('. ')}." }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue