GRN2-140: Added Email to inform user they've been promoted (#534)

* Added Email to inform user they've been promoted

* Update user_mailer.rb

* Send email when a user is demoted

* Change more-info string
This commit is contained in:
shawn-higgins1
2019-05-22 13:36:33 -04:00
committed by Jesus Federico
parent 9638ebcbc5
commit 83a9edf81d
10 changed files with 208 additions and 0 deletions

View File

@ -64,6 +64,14 @@ describe AdminsController, type: :controller do
expect(flash[:success]).to be_present
expect(response).to redirect_to(admins_path)
end
it "sends an email to the user being promoted" do
@request.session[:user_id] = @admin.id
params = { user_uid: @user.uid }
expect { post :promote, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
context "POST #demote" do
@ -79,6 +87,16 @@ describe AdminsController, type: :controller do
expect(flash[:success]).to be_present
expect(response).to redirect_to(admins_path)
end
it "sends an email to the user being demoted" do
@request.session[:user_id] = @admin.id
@user.add_role :admin
params = { user_uid: @user.uid }
expect { post :demote, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
context "POST #ban" do