diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-06-15 17:30:55 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-07-05 16:54:22 -0500 |
commit | 512adc21feff5135de94d23ed6808296b365490a (patch) | |
tree | a1067fee6ea02eeae2f13750f17b64ff7544a9b0 /spec/features | |
parent | 1141eaf5c83f927ccc064b6c5d162081fdd22894 (diff) | |
download | gitlab-ce-512adc21feff5135de94d23ed6808296b365490a.tar.gz |
Add setting that allows admins to choose which Git access protocols are enabled
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_disables_git_access_protocol_spec.rb | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb new file mode 100644 index 00000000000..550dcb62453 --- /dev/null +++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb @@ -0,0 +1,66 @@ +require 'rails_helper' + +feature 'Admin disables Git access protocol', feature: true do + let(:project) { create(:empty_project, :empty_repo) } + let(:admin) { create(:admin) } + + background do + login_as(admin) + end + + context 'with HTTP disabled' do + background do + disable_http_protocol + end + + scenario 'shows only SSH url' do + visit_project + + expect(page).to have_content("git clone #{project.ssh_url_to_repo}") + expect(page).not_to have_selector('#clone-dropdown') + end + end + + context 'with SSH disabled' do + background do + disable_ssh_protocol + end + + scenario 'shows only HTTP url' do + visit_project + + expect(page).to have_content("git clone #{project.http_url_to_repo}") + expect(page).not_to have_selector('#clone-dropdown') + end + end + + context 'with nothing disabled' do + background do + create(:personal_key, user: admin) + end + + scenario 'shows default SSH url and protocol selection dropdown' do + visit_project + + expect(page).to have_content("git clone #{project.ssh_url_to_repo}") + expect(page).to have_selector('#clone-dropdown') + end + + end + + def visit_project + visit namespace_project_path(project.namespace, project) + end + + def disable_http_protocol + visit admin_application_settings_path + find('#application_setting_enabled_git_access_protocols').find(:xpath, 'option[2]').select_option + click_on 'Save' + end + + def disable_ssh_protocol + visit admin_application_settings_path + find('#application_setting_enabled_git_access_protocols').find(:xpath, 'option[3]').select_option + click_on 'Save' + end +end |