diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-19 12:08:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-19 12:08:53 +0300 |
commit | 472a7da0e565894f7128becb5b1cf67572a13491 (patch) | |
tree | b97da413901b64dbe6b422362cae6ec9396cf639 /spec/features/groups_spec.rb | |
parent | 0f26d7c7fb43f3fbc1ba0ee5b1c5537e7646dffd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/groups_spec.rb')
-rw-r--r-- | spec/features/groups_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 28b22860f0a..33afa5d04e5 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -141,6 +141,30 @@ RSpec.describe 'Group' do end end end + + describe 'showing recaptcha on group creation when it is enabled' do + before do + stub_application_setting(recaptcha_enabled: true) + allow(Gitlab::Recaptcha).to receive(:load_configurations!) + visit new_group_path + end + + it 'renders recaptcha' do + expect(page).to have_css('.recaptcha') + end + end + + describe 'not showing recaptcha on group creation when it is disabled' do + before do + stub_feature_flags(recaptcha_on_top_level_group_creation: false) + stub_application_setting(recaptcha_enabled: true) + visit new_group_path + end + + it 'does not render recaptcha' do + expect(page).not_to have_css('.recaptcha') + end + end end describe 'create a nested group' do @@ -189,6 +213,23 @@ RSpec.describe 'Group' do expect(page).to have_content("Group 'bar' was successfully created.") end end + + context 'when recaptcha is enabled' do + before do + stub_application_setting(recaptcha_enabled: true) + allow(Gitlab::Recaptcha).to receive(:load_configurations!) + end + + context 'when creating subgroup' do + let(:path) { new_group_path(group, parent_id: group.id) } + + it 'does not render recaptcha' do + visit path + + expect(page).not_to have_css('.recaptcha') + end + end + end end it 'checks permissions to avoid exposing groups by parent_id' do |