summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorLuke Bennett <lbennett@gitlab.com>2018-11-28 20:31:01 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-12-03 13:41:09 -0200
commita0d5b5adf8b8e891c9486348238b8e7713aea4ff (patch)
treeb89ca3fb30ebd6973d981810f3b3fa82ac68e94e /spec/features
parent0566bbd064e2fd6bf37bffc146a4c48aacf7059a (diff)
downloadgitlab-ce-a0d5b5adf8b8e891c9486348238b8e7713aea4ff.tar.gz
Add test for "only mirror protected branches" setting
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/projects/settings/repository_settings_spec.rb56
1 files changed, 49 insertions, 7 deletions
diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb
index 401aac9478d..b7a22316d26 100644
--- a/spec/features/projects/settings/repository_settings_spec.rb
+++ b/spec/features/projects/settings/repository_settings_spec.rb
@@ -133,19 +133,50 @@ describe 'Projects > Settings > Repository settings' do
expect(page).to have_selector('#mirror_direction')
end
- it 'generates an SSH public key on submission', :js do
+ it 'creates a push mirror that mirrors all branches', :js do
+ expect(find('.js-mirror-protected-hidden', visible: false).value).to eq('0')
+
fill_in 'url', with: 'ssh://user@localhost/project.git'
select 'SSH public key', from: 'Authentication method'
- direction_select = find('#mirror_direction')
+ select_direction
- # In CE, this select box is disabled, but in EE, it is enabled
- if direction_select.disabled?
- expect(direction_select.value).to eq('push')
- else
- direction_select.select('Push')
+ Sidekiq::Testing.fake! do
+ click_button 'Mirror repository'
end
+ project.reload
+
+ expect(page).to have_content('Mirroring settings were successfully updated')
+ expect(project.remote_mirrors.first.only_protected_branches).to eq(false)
+ end
+
+ it 'creates a push mirror that only mirrors protected branches', :js do
+ find('#only_protected_branches').click
+
+ expect(find('.js-mirror-protected-hidden', visible: false).value).to eq('1')
+
+ fill_in 'url', with: 'ssh://user@localhost/project.git'
+ select 'SSH public key', from: 'Authentication method'
+
+ select_direction
+
+ Sidekiq::Testing.fake! do
+ click_button 'Mirror repository'
+ end
+
+ project.reload
+
+ expect(page).to have_content('Mirroring settings were successfully updated')
+ expect(project.remote_mirrors.first.only_protected_branches).to eq(true)
+ end
+
+ it 'generates an SSH public key on submission', :js do
+ fill_in 'url', with: 'ssh://user@localhost/project.git'
+ select 'SSH public key', from: 'Authentication method'
+
+ select_direction
+
Sidekiq::Testing.fake! do
click_button 'Mirror repository'
end
@@ -153,6 +184,17 @@ describe 'Projects > Settings > Repository settings' do
expect(page).to have_content('Mirroring settings were successfully updated')
expect(page).to have_selector('[title="Copy SSH public key"]')
end
+
+ def select_direction(direction = 'push')
+ direction_select = find('#mirror_direction')
+
+ # In CE, this select box is disabled, but in EE, it is enabled
+ if direction_select.disabled?
+ expect(direction_select.value).to eq(direction)
+ else
+ direction_select.select(direction.capitalize)
+ end
+ end
end
end
end