Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/users/callouts_helper_spec.rb')
-rw-r--r--spec/helpers/users/callouts_helper_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/helpers/users/callouts_helper_spec.rb b/spec/helpers/users/callouts_helper_spec.rb
index 85e11c2ed3b..71a8d340b30 100644
--- a/spec/helpers/users/callouts_helper_spec.rb
+++ b/spec/helpers/users/callouts_helper_spec.rb
@@ -103,6 +103,7 @@ RSpec.describe Users::CalloutsHelper do
allow(helper).to receive(:current_user).and_return(admin)
stub_application_setting(signup_enabled: true)
allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { false }
+ allow(helper.controller).to receive(:controller_path).and_return("admin/users")
end
it { is_expected.to be false }
@@ -114,6 +115,7 @@ RSpec.describe Users::CalloutsHelper do
allow(helper).to receive(:current_user).and_return(user)
stub_application_setting(signup_enabled: true)
allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { false }
+ allow(helper.controller).to receive(:controller_path).and_return("admin/users")
end
it { is_expected.to be false }
@@ -125,6 +127,7 @@ RSpec.describe Users::CalloutsHelper do
allow(helper).to receive(:current_user).and_return(admin)
stub_application_setting(signup_enabled: false)
allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { false }
+ allow(helper.controller).to receive(:controller_path).and_return("admin/users")
end
it { is_expected.to be false }
@@ -136,17 +139,31 @@ RSpec.describe Users::CalloutsHelper do
allow(helper).to receive(:current_user).and_return(admin)
stub_application_setting(signup_enabled: true)
allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { true }
+ allow(helper.controller).to receive(:controller_path).and_return("admin/users")
end
it { is_expected.to be false }
end
- context 'when not gitlab.com, `current_user` is an admin, signup is enabled, and user has not dismissed callout' do
+ context 'when controller path is not allowed' do
before do
allow(::Gitlab).to receive(:com?).and_return(false)
allow(helper).to receive(:current_user).and_return(admin)
stub_application_setting(signup_enabled: true)
allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { false }
+ allow(helper.controller).to receive(:controller_path).and_return("projects/issues")
+ end
+
+ it { is_expected.to be false }
+ end
+
+ context 'when not gitlab.com, `current_user` is an admin, signup is enabled, user has not dismissed callout, and controller path is allowed' do
+ before do
+ allow(::Gitlab).to receive(:com?).and_return(false)
+ allow(helper).to receive(:current_user).and_return(admin)
+ stub_application_setting(signup_enabled: true)
+ allow(helper).to receive(:user_dismissed?).with(described_class::REGISTRATION_ENABLED_CALLOUT) { false }
+ allow(helper.controller).to receive(:controller_path).and_return("admin/users")
end
it { is_expected.to be true }