From 2a0a2a59a945325c7ddc4ef5265fc4fabd51767a Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:32:55 +0000 Subject: [PATCH] Add success banner for new users (#2827) --- app/controllers/users_controller.rb | 1 + spec/requests/users_controller_spec.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f27bfc2b3..57036cabe 100644 --- a/app/controllers/users_controller.rb +++ b/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? diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 1b62196bb..2b7210402 100644 --- a/spec/requests/users_controller_spec.rb +++ b/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