Merge pull request #527 from differentreality/wording

Wording
This commit is contained in:
Stella Rouzi 2014-11-12 13:38:14 +02:00
commit cac0041819
3 changed files with 13 additions and 6 deletions

View file

@ -20,8 +20,15 @@ module Admin
end
def update
message = ''
if params[:user] && !params[:user][:email].nil?
if (new_email = params[:user][:email]) != @user.email
message = " Confirmation email sent to #{new_email}. The new email needs to be confirmed before it can be used."
end
end
if @user.update_attributes(params[:user])
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!"
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
else
redirect_to admin_users_path, alert: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."
end

View file

@ -6,7 +6,7 @@
%li
= link_to(edit_user_path(current_user.id)) do
%span.fa.fa-user
Edit Profil
Edit Profile
-if @conference and @conference.id
%li
= link_to(conference_proposal_index_path(@conference.short_title)) do

View file

@ -7,8 +7,8 @@ describe Admin::UsersController do
end
describe 'GET #index' do
it 'populates an array of users' do
user1 = create(:user, email: 'gopesh.7500@gmail.com')
user2 = create(:user, email: 'gopesh_750@gmail.com')
user1 = create(:user, email: 'user1@email.osem')
user2 = create(:user, email: 'user2@email.osem')
get :index
expect(assigns(:users)).to match_array([user, admin, user1, user2])
end
@ -26,8 +26,8 @@ describe Admin::UsersController do
it 'changes @users attributes' do
patch :update, id: user.id
expect(build(
:user, email: 'example@incoherent.de', id: user.id).email).
to eq('example@incoherent.de')
:user, email: 'new@email.osem', id: user.id).email).
to eq('new@email.osem')
end
it 'redirects to the updated user' do
patch :update, id: user.id