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/features/callouts/registration_enabled_spec.rb')
-rw-r--r--spec/features/callouts/registration_enabled_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/callouts/registration_enabled_spec.rb b/spec/features/callouts/registration_enabled_spec.rb
new file mode 100644
index 00000000000..4055965273f
--- /dev/null
+++ b/spec/features/callouts/registration_enabled_spec.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Registration enabled callout' do
+ let_it_be(:admin) { create(:admin) }
+ let_it_be(:non_admin) { create(:user) }
+
+ context 'when "Sign-up enabled" setting is `true`' do
+ before do
+ stub_application_setting(signup_enabled: true)
+ end
+
+ context 'when an admin is logged in' do
+ before do
+ sign_in(admin)
+ visit root_dashboard_path
+ end
+
+ it 'displays callout' do
+ expect(page).to have_content 'Open registration is enabled on your instance.'
+ expect(page).to have_link 'View setting', href: general_admin_application_settings_path(anchor: 'js-signup-settings')
+ end
+
+ context 'when callout is dismissed', :js do
+ before do
+ find('[data-testid="close-registration-enabled-callout"]').click
+
+ visit root_dashboard_path
+ end
+
+ it 'does not display callout' do
+ expect(page).not_to have_content 'Open registration is enabled on your instance.'
+ end
+ end
+ end
+
+ context 'when a non-admin is logged in' do
+ before do
+ sign_in(non_admin)
+ visit root_dashboard_path
+ end
+
+ it 'does not display callout' do
+ expect(page).not_to have_content 'Open registration is enabled on your instance.'
+ end
+ end
+ end
+end