Browse Source

Add success banner for new users (#2827)

pull/2805/head^2
kosiakkatrina 2 months ago committed by GitHub
parent
commit
2a0a2a59a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/controllers/users_controller.rb
  2. 3
      spec/requests/users_controller_spec.rb

1
app/controllers/users_controller.rb

@ -114,6 +114,7 @@ class UsersController < ApplicationController
validate_attributes
if @user.errors.empty? && @user.save
flash[:notice] = "Invitation sent to #{@user.email}"
redirect_to created_user_redirect_path
else
unless @user.errors[:organisation].empty?

3
spec/requests/users_controller_spec.rb

@ -1043,6 +1043,9 @@ RSpec.describe UsersController, type: :request do
it "invites a new user" do
expect { request }.to change(User, :count).by(1)
follow_redirect!
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
expect(page).to have_content("Invitation sent to new_user@example.com")
end
it "sends an invitation email" do

Loading…
Cancel
Save