Merge pull request #122 from ChrisBr/conference_alert

Conference alert
This commit is contained in:
Christian Bruckmayer 2014-05-15 13:16:29 +02:00
commit c9b65e9a5d
2 changed files with 8 additions and 5 deletions

View file

@ -21,7 +21,8 @@ class Admin::ConferenceController < ApplicationController
notice: 'Conference was successfully created.')
else
redirect_to(new_admin_conference_path,
flash: { error: @conference.errors.full_messages.join('! ') })
alert: 'Creating the Conference failed.' \
"#{@conference.errors.full_messages.join('. ')}.")
end
end
@ -32,9 +33,9 @@ class Admin::ConferenceController < ApplicationController
redirect_to(admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully updated.')
else
errors = @conference.errors.full_messages.join('! ')
redirect_to(admin_conference_path(id: short_title),
flash: { error: "Conference update failed. #{errors}" })
alert: 'Updating conference failed. ' \
"#{@conference.errors.full_messages.join('. ')}.")
end
end

View file

@ -48,7 +48,8 @@ describe Admin::ConferenceController do
short_title: nil)
conference.reload
expect(flash[:error]).to eq("Conference update failed. Short title can't be blank")
expect(flash[:alert]).
to eq("Updating conference failed. Short title can't be blank.")
expect(conference.title).to eq('The dog and pony show')
expect(conference.short_title).to eq('dps14')
end
@ -58,7 +59,8 @@ describe Admin::ConferenceController do
attributes_for(:conference, title: 'Example Con',
short_title: nil)
expect(flash[:error]).to eq("Conference update failed. Short title can't be blank")
expect(flash[:alert]).
to eq("Updating conference failed. Short title can't be blank.")
expect(response).to redirect_to admin_conference_path(
conference.short_title)
end