diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/controllers/admin | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/controllers/admin')
13 files changed, 174 insertions, 159 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 32ac0f8dc07..a721722a5c3 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_setting do +RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_setting, feature_category: :shared do include StubENV include UsageDataHelpers @@ -204,8 +204,29 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set expect(ApplicationSetting.current.valid_runner_registrars).to eq(['project']) end + it 'updates GitLab for Slack app settings' do + settings = { + slack_app_enabled: true, + slack_app_id: 'slack_app_id', + slack_app_secret: 'slack_app_secret', + slack_app_signing_secret: 'slack_app_signing_secret', + slack_app_verification_token: 'slack_app_verification_token' + } + + put :update, params: { application_setting: settings } + + expect(response).to redirect_to(general_admin_application_settings_path) + expect(ApplicationSetting.current).to have_attributes( + slack_app_enabled: true, + slack_app_id: 'slack_app_id', + slack_app_secret: 'slack_app_secret', + slack_app_signing_secret: 'slack_app_signing_secret', + slack_app_verification_token: 'slack_app_verification_token' + ) + end + context 'boolean attributes' do - shared_examples_for 'updates booolean attribute' do |attribute| + shared_examples_for 'updates boolean attribute' do |attribute| specify do existing_value = ApplicationSetting.current.public_send(attribute) new_value = !existing_value @@ -217,10 +238,11 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set end end - it_behaves_like 'updates booolean attribute', :user_defaults_to_private_profile - it_behaves_like 'updates booolean attribute', :can_create_group - it_behaves_like 'updates booolean attribute', :admin_mode - it_behaves_like 'updates booolean attribute', :require_admin_approval_after_user_signup + it_behaves_like 'updates boolean attribute', :user_defaults_to_private_profile + it_behaves_like 'updates boolean attribute', :can_create_group + it_behaves_like 'updates boolean attribute', :admin_mode + it_behaves_like 'updates boolean attribute', :require_admin_approval_after_user_signup + it_behaves_like 'updates boolean attribute', :remember_me_enabled end context "personal access token prefix settings" do @@ -398,9 +420,20 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set expect(application_settings.reload.invitation_flow_enforcement).to eq(true) end end + + context 'maximum includes' do + let(:application_settings) { ApplicationSetting.current } + + it 'updates ci_max_includes setting' do + put :update, params: { application_setting: { ci_max_includes: 200 } } + + expect(response).to redirect_to(general_admin_application_settings_path) + expect(application_settings.reload.ci_max_includes).to eq(200) + end + end end - describe 'PUT #reset_registration_token', feature_category: :credential_management do + describe 'PUT #reset_registration_token', feature_category: :user_management do before do sign_in(admin) end diff --git a/spec/controllers/admin/applications_controller_spec.rb b/spec/controllers/admin/applications_controller_spec.rb index bf7707f177c..1feda0ed36f 100644 --- a/spec/controllers/admin/applications_controller_spec.rb +++ b/spec/controllers/admin/applications_controller_spec.rb @@ -38,44 +38,49 @@ RSpec.describe Admin::ApplicationsController do end end - describe 'POST #create' do - context 'with hash_oauth_secrets flag off' do - before do - stub_feature_flags(hash_oauth_secrets: false) - end + describe 'PUT #renew' do + let(:oauth_params) do + { + id: application.id + } + end - it 'creates the application' do - create_params = attributes_for(:application, trusted: true, confidential: false, scopes: ['api']) + subject { put :renew, params: oauth_params } - expect do - post :create, params: { doorkeeper_application: create_params } - end.to change { Doorkeeper::Application.count }.by(1) + it { is_expected.to have_gitlab_http_status(:ok) } + it { expect { subject }.to change { application.reload.secret } } - application = Doorkeeper::Application.last + it 'returns the secret in json format' do + subject - expect(response).to redirect_to(admin_application_path(application)) - expect(application).to have_attributes(create_params.except(:uid, :owner_type)) - end + expect(json_response['secret']).not_to be_nil end - context 'with hash_oauth_secrets flag on' do + context 'when renew fails' do before do - stub_feature_flags(hash_oauth_secrets: true) + allow_next_found_instance_of(Doorkeeper::Application) do |application| + allow(application).to receive(:save).and_return(false) + end end - it 'creates the application' do - create_params = attributes_for(:application, trusted: true, confidential: false, scopes: ['api']) + it { expect { subject }.not_to change { application.reload.secret } } + it { is_expected.to have_gitlab_http_status(:unprocessable_entity) } + end + end - expect do - post :create, params: { doorkeeper_application: create_params } - end.to change { Doorkeeper::Application.count }.by(1) + describe 'POST #create' do + it 'creates the application' do + create_params = attributes_for(:application, trusted: true, confidential: false, scopes: ['api']) - application = Doorkeeper::Application.last + expect do + post :create, params: { doorkeeper_application: create_params } + end.to change { Doorkeeper::Application.count }.by(1) - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template :show - expect(application).to have_attributes(create_params.except(:uid, :owner_type)) - end + application = Doorkeeper::Application.last + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template :show + expect(application).to have_attributes(create_params.except(:uid, :owner_type)) end it 'renders the application form on errors' do @@ -88,43 +93,18 @@ RSpec.describe Admin::ApplicationsController do end context 'when the params are for a confidential application' do - context 'with hash_oauth_secrets flag off' do - before do - stub_feature_flags(hash_oauth_secrets: false) - end - - it 'creates a confidential application' do - create_params = attributes_for(:application, confidential: true, scopes: ['read_user']) - - expect do - post :create, params: { doorkeeper_application: create_params } - end.to change { Doorkeeper::Application.count }.by(1) - - application = Doorkeeper::Application.last - - expect(response).to redirect_to(admin_application_path(application)) - expect(application).to have_attributes(create_params.except(:uid, :owner_type)) - end - end + it 'creates a confidential application' do + create_params = attributes_for(:application, confidential: true, scopes: ['read_user']) - context 'with hash_oauth_secrets flag on' do - before do - stub_feature_flags(hash_oauth_secrets: true) - end - - it 'creates a confidential application' do - create_params = attributes_for(:application, confidential: true, scopes: ['read_user']) - - expect do - post :create, params: { doorkeeper_application: create_params } - end.to change { Doorkeeper::Application.count }.by(1) + expect do + post :create, params: { doorkeeper_application: create_params } + end.to change { Doorkeeper::Application.count }.by(1) - application = Doorkeeper::Application.last + application = Doorkeeper::Application.last - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template :show - expect(application).to have_attributes(create_params.except(:uid, :owner_type)) - end + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template :show + expect(application).to have_attributes(create_params.except(:uid, :owner_type)) end end diff --git a/spec/controllers/admin/clusters_controller_spec.rb b/spec/controllers/admin/clusters_controller_spec.rb index 8e62aeed7d0..d04cd20f4e6 100644 --- a/spec/controllers/admin/clusters_controller_spec.rb +++ b/spec/controllers/admin/clusters_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::ClustersController, feature_category: :kubernetes_management do +RSpec.describe Admin::ClustersController, feature_category: :deployment_management do include AccessMatchersForController include GoogleApi::CloudPlatformHelpers @@ -259,14 +259,6 @@ RSpec.describe Admin::ClustersController, feature_category: :kubernetes_manageme expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('cluster_status') end - - it 'invokes schedule_status_update on each application' do - expect_next_instance_of(Clusters::Applications::Ingress) do |instance| - expect(instance).to receive(:schedule_status_update) - end - - get_cluster_status - end end describe 'security' do @@ -292,20 +284,37 @@ RSpec.describe Admin::ClustersController, feature_category: :kubernetes_manageme end describe 'functionality' do - render_views + context 'when remove_monitor_metrics FF is disabled' do + before do + stub_feature_flags(remove_monitor_metrics: false) + end - it 'responds successfully' do - get_show + render_views - expect(response).to have_gitlab_http_status(:ok) - expect(assigns(:cluster)).to eq(cluster) + it 'responds successfully' do + get_show + + expect(response).to have_gitlab_http_status(:ok) + expect(assigns(:cluster)).to eq(cluster) + end + + it 'renders integration tab view' do + get_show(tab: 'integrations') + + expect(response).to render_template('clusters/clusters/_integrations') + expect(response).to have_gitlab_http_status(:ok) + end end - it 'renders integration tab view' do - get_show(tab: 'integrations') + context 'when remove_monitor_metrics FF is enabled' do + render_views - expect(response).to render_template('clusters/clusters/_integrations') - expect(response).to have_gitlab_http_status(:ok) + it 'renders details tab view' do + get_show(tab: 'integrations') + + expect(response).to render_template('clusters/clusters/_details') + expect(response).to have_gitlab_http_status(:ok) + end end end diff --git a/spec/controllers/admin/cohorts_controller_spec.rb b/spec/controllers/admin/cohorts_controller_spec.rb index 50626a5da91..26f6540258e 100644 --- a/spec/controllers/admin/cohorts_controller_spec.rb +++ b/spec/controllers/admin/cohorts_controller_spec.rb @@ -17,7 +17,6 @@ RSpec.describe Admin::CohortsController do it_behaves_like 'Snowplow event tracking with RedisHLL context' do subject { get :index } - let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } let(:category) { described_class.name } let(:action) { 'perform_analytics_usage_action' } let(:label) { 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly' } diff --git a/spec/controllers/admin/dev_ops_report_controller_spec.rb b/spec/controllers/admin/dev_ops_report_controller_spec.rb index 52a46b5e99a..d8166380760 100644 --- a/spec/controllers/admin/dev_ops_report_controller_spec.rb +++ b/spec/controllers/admin/dev_ops_report_controller_spec.rb @@ -32,7 +32,6 @@ RSpec.describe Admin::DevOpsReportController do it_behaves_like 'Snowplow event tracking with RedisHLL context' do subject { get :show, format: :html } - let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } let(:category) { described_class.name } let(:action) { 'perform_analytics_usage_action' } let(:label) { 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly' } diff --git a/spec/controllers/admin/instance_review_controller_spec.rb b/spec/controllers/admin/instance_review_controller_spec.rb index 6eab135b3a6..f0225a71e00 100644 --- a/spec/controllers/admin/instance_review_controller_spec.rb +++ b/spec/controllers/admin/instance_review_controller_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Admin::InstanceReviewController, feature_category: :service_ping include UsageDataHelpers let(:admin) { create(:admin) } - let(:subscriptions_instance_review_url) { Gitlab::SubscriptionPortal.subscriptions_instance_review_url } + let(:subscriptions_instance_review_url) { ::Gitlab::Routing.url_helpers.subscription_portal_instance_review_url } before do sign_in(admin) diff --git a/spec/controllers/admin/integrations_controller_spec.rb b/spec/controllers/admin/integrations_controller_spec.rb index e75f27589d7..9e2a2900b33 100644 --- a/spec/controllers/admin/integrations_controller_spec.rb +++ b/spec/controllers/admin/integrations_controller_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Admin::IntegrationsController do let(:admin) { create(:admin) } before do + stub_feature_flags(remove_monitor_metrics: false) sign_in(admin) end @@ -29,11 +30,7 @@ RSpec.describe Admin::IntegrationsController do end end - context 'when GitLab.com' do - before do - allow(::Gitlab).to receive(:com?) { true } - end - + context 'when GitLab.com', :saas do it 'returns 404' do get :edit, params: { id: Integration.available_integration_names.sample } diff --git a/spec/controllers/admin/runner_projects_controller_spec.rb b/spec/controllers/admin/runner_projects_controller_spec.rb index 38cc2d171ac..06a73984ac0 100644 --- a/spec/controllers/admin/runner_projects_controller_spec.rb +++ b/spec/controllers/admin/runner_projects_controller_spec.rb @@ -21,30 +21,32 @@ RSpec.describe Admin::RunnerProjectsController, feature_category: :runner_fleet } end - context 'assigning runner to same project' do - let(:project_runner) { create(:ci_runner, :project, projects: [project]) } + context 'when assigning to another project' do + let(:project_runner) { create(:ci_runner, :project, projects: [source_project]) } + let(:source_project) { create(:project) } it 'redirects to the admin runner edit page' do send_create + expect(flash[:success]).to be_present expect(response).to have_gitlab_http_status(:redirect) expect(response).to redirect_to edit_admin_runner_url(project_runner) end end - context 'assigning runner to another project' do - let(:project_runner) { create(:ci_runner, :project, projects: [source_project]) } - let(:source_project) { create(:project) } + context 'when assigning to same project' do + let(:project_runner) { create(:ci_runner, :project, projects: [project]) } it 'redirects to the admin runner edit page' do send_create + expect(flash[:alert]).to be_present expect(response).to have_gitlab_http_status(:redirect) expect(response).to redirect_to edit_admin_runner_url(project_runner) end end - context 'for unknown project' do + context 'when assigning to an unknown project' do let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project]) } let(:project_id) { 0 } @@ -70,7 +72,7 @@ RSpec.describe Admin::RunnerProjectsController, feature_category: :runner_fleet } end - context 'unassigning runner from project' do + context 'when unassigning runner from project' do let(:runner_project_id) { project_runner.runner_projects.last.id } it 'redirects to the admin runner edit page' do @@ -81,7 +83,7 @@ RSpec.describe Admin::RunnerProjectsController, feature_category: :runner_fleet end end - context 'for unknown project runner relationship' do + context 'when unassigning from unknown project' do let(:runner_project_id) { 0 } it 'shows 404 for unknown project runner relationship' do diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb index a39a1f38a11..b1a2d90589a 100644 --- a/spec/controllers/admin/runners_controller_spec.rb +++ b/spec/controllers/admin/runners_controller_spec.rb @@ -35,26 +35,59 @@ RSpec.describe Admin::RunnersController, feature_category: :runner_fleet do end describe '#new' do - context 'when create_runner_workflow is enabled' do + it 'renders a :new template' do + get :new + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template(:new) + end + + context 'when create_runner_workflow_for_admin is disabled' do before do - stub_feature_flags(create_runner_workflow: true) + stub_feature_flags(create_runner_workflow_for_admin: false) end - it 'renders a :new template' do + it 'returns :not_found' do get :new + expect(response).to have_gitlab_http_status(:not_found) + end + end + end + + describe '#register' do + subject(:register) { get :register, params: { id: new_runner.id } } + + context 'when runner can be registered after creation' do + let_it_be(:new_runner) { create(:ci_runner, registration_type: :authenticated_user) } + + it 'renders a :register template' do + register + expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template(:new) + expect(response).to render_template(:register) end end - context 'when create_runner_workflow is disabled' do + context 'when runner cannot be registered after creation' do + let_it_be(:new_runner) { runner } + + it 'returns :not_found' do + register + + expect(response).to have_gitlab_http_status(:not_found) + end + end + + context 'when create_runner_workflow_for_admin is disabled' do + let_it_be(:new_runner) { create(:ci_runner, registration_type: :authenticated_user) } + before do - stub_feature_flags(create_runner_workflow: false) + stub_feature_flags(create_runner_workflow_for_admin: false) end it 'returns :not_found' do - get :new + register expect(response).to have_gitlab_http_status(:not_found) end diff --git a/spec/controllers/admin/sessions_controller_spec.rb b/spec/controllers/admin/sessions_controller_spec.rb index 5fa7a7f278d..07088eed6d4 100644 --- a/spec/controllers/admin/sessions_controller_spec.rb +++ b/spec/controllers/admin/sessions_controller_spec.rb @@ -220,7 +220,9 @@ RSpec.describe Admin::SessionsController, :do_not_mock_admin_mode do end end - shared_examples 'when using two-factor authentication via hardware device' do + context 'when using two-factor authentication via WebAuthn' do + let(:user) { create(:admin, :two_factor_via_webauthn) } + def authenticate_2fa(user_params) post(:create, params: { user: user_params }, session: { otp_user_id: user.id }) end @@ -237,10 +239,6 @@ RSpec.describe Admin::SessionsController, :do_not_mock_admin_mode do end it 'can login with valid auth' do - # we can stub both without an differentiation between webauthn / u2f - # as these not interfere with each other und this saves us passing aroud - # parameters - allow(U2fRegistration).to receive(:authenticate).and_return(true) allow_any_instance_of(Webauthn::AuthenticateService).to receive(:execute).and_return(true) expect(controller.current_user_mode.admin_mode?).to be(false) @@ -255,7 +253,6 @@ RSpec.describe Admin::SessionsController, :do_not_mock_admin_mode do end it 'cannot login with invalid auth' do - allow(U2fRegistration).to receive(:authenticate).and_return(false) allow_any_instance_of(Webauthn::AuthenticateService).to receive(:execute).and_return(false) expect(controller.current_user_mode.admin_mode?).to be(false) @@ -267,22 +264,6 @@ RSpec.describe Admin::SessionsController, :do_not_mock_admin_mode do expect(controller.current_user_mode.admin_mode?).to be(false) end end - - context 'when using two-factor authentication via U2F' do - it_behaves_like 'when using two-factor authentication via hardware device' do - let(:user) { create(:admin, :two_factor_via_u2f) } - - before do - stub_feature_flags(webauthn: false) - end - end - end - - context 'when using two-factor authentication via WebAuthn' do - it_behaves_like 'when using two-factor authentication via hardware device' do - let(:user) { create(:admin, :two_factor_via_webauthn) } - end - end end end diff --git a/spec/controllers/admin/spam_logs_controller_spec.rb b/spec/controllers/admin/spam_logs_controller_spec.rb index 51f7ecdece6..b39c3bd009b 100644 --- a/spec/controllers/admin/spam_logs_controller_spec.rb +++ b/spec/controllers/admin/spam_logs_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::SpamLogsController do +RSpec.describe Admin::SpamLogsController, feature_category: :instance_resiliency do let(:admin) { create(:admin) } let(:user) { create(:user) } let!(:first_spam) { create(:spam_log, user: user) } @@ -13,9 +13,10 @@ RSpec.describe Admin::SpamLogsController do end describe '#index' do - it 'lists all spam logs' do + it 'lists paginated spam logs' do get :index + expect(assigns(:spam_logs)).to be_kind_of(Kaminari::PaginatableWithoutCount) expect(response).to have_gitlab_http_status(:ok) end end @@ -33,10 +34,7 @@ RSpec.describe Admin::SpamLogsController do end.not_to change { SpamLog.count } expect(response).to have_gitlab_http_status(:found) - expect( - Users::GhostUserMigration.where(user: user, - initiator_user: admin) - ).to be_exists + expect(Users::GhostUserMigration.where(user: user, initiator_user: admin)).to be_exists expect(flash[:notice]).to eq("User #{user.username} was successfully removed.") end end diff --git a/spec/controllers/admin/usage_trends_controller_spec.rb b/spec/controllers/admin/usage_trends_controller_spec.rb index 87cf8988b4e..7b801d53f14 100644 --- a/spec/controllers/admin/usage_trends_controller_spec.rb +++ b/spec/controllers/admin/usage_trends_controller_spec.rb @@ -17,7 +17,6 @@ RSpec.describe Admin::UsageTrendsController do it_behaves_like 'Snowplow event tracking with RedisHLL context' do subject { get :index } - let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } let(:category) { described_class.name } let(:action) { 'perform_analytics_usage_action' } let(:label) { 'redis_hll_counters.analytics.analytics_total_unique_counts_monthly' } diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 63e68118066..9b00451de30 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -185,22 +185,14 @@ RSpec.describe Admin::UsersController do delete :destroy, params: { id: user.username }, format: :json expect(response).to have_gitlab_http_status(:ok) - expect( - Users::GhostUserMigration.where(user: user, - initiator_user: admin, - hard_delete: false) - ).to be_exists + expect(Users::GhostUserMigration.where(user: user, initiator_user: admin, hard_delete: false)).to be_exists end it 'initiates user removal and passes hard delete option' do delete :destroy, params: { id: user.username, hard_delete: true }, format: :json expect(response).to have_gitlab_http_status(:ok) - expect( - Users::GhostUserMigration.where(user: user, - initiator_user: admin, - hard_delete: true) - ).to be_exists + expect(Users::GhostUserMigration.where(user: user, initiator_user: admin, hard_delete: true)).to be_exists end context 'prerequisites for account deletion' do @@ -231,11 +223,7 @@ RSpec.describe Admin::UsersController do expect(response).to redirect_to(admin_users_path) expect(flash[:notice]).to eq(_('The user is being deleted.')) - expect( - Users::GhostUserMigration.where(user: user, - initiator_user: admin, - hard_delete: true) - ).to be_exists + expect(Users::GhostUserMigration.where(user: user, initiator_user: admin, hard_delete: true)).to be_exists end end end @@ -252,10 +240,7 @@ RSpec.describe Admin::UsersController do it 'initiates user removal', :sidekiq_inline do subject - expect( - Users::GhostUserMigration.where(user: user, - initiator_user: admin) - ).to be_exists + expect(Users::GhostUserMigration.where(user: user, initiator_user: admin)).to be_exists end it 'displays the rejection message' do @@ -403,7 +388,7 @@ RSpec.describe Admin::UsersController do put :deactivate, params: { id: user.username } user.reload expect(user.deactivated?).to be_falsey - expect(flash[:notice]).to eq("The user you are trying to deactivate has been active in the past #{Gitlab::CurrentSettings.deactivate_dormant_users_period} days and cannot be deactivated") + expect(flash[:alert]).to eq("The user you are trying to deactivate has been active in the past #{Gitlab::CurrentSettings.deactivate_dormant_users_period} days and cannot be deactivated") end end end @@ -425,7 +410,7 @@ RSpec.describe Admin::UsersController do put :deactivate, params: { id: user.username } user.reload expect(user.deactivated?).to be_falsey - expect(flash[:notice]).to eq('Error occurred. A blocked user cannot be deactivated') + expect(flash[:alert]).to eq('Error occurred. A blocked user cannot be deactivated') end end @@ -436,7 +421,7 @@ RSpec.describe Admin::UsersController do put :deactivate, params: { id: internal_user.username } expect(internal_user.reload.deactivated?).to be_falsey - expect(flash[:notice]).to eq('Internal users cannot be deactivated') + expect(flash[:alert]).to eq('Internal users cannot be deactivated') end end end |