diff options
author | Rémy Coutable <remy@rymai.me> | 2016-05-09 17:48:48 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-05-09 17:48:48 +0300 |
commit | d4d34b161b41539567332d45527bb10c9f0665e3 (patch) | |
tree | 484145a78e7aa113ca631a68c1aab45097394c66 /spec/features | |
parent | bdfe6dc319571dbae8340a7132e5bd6a8ea06764 (diff) | |
parent | f18ec70743375024aa7ec7bb86c437ca9198e729 (diff) |
Merge branch 'rs-backport-ee-372' into 'master'
Backport changes from gitlab-org/gitlab-ee!372
Mostly replaces several Spinach tests with RSpec Feature tests.
See merge request !4043
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/developer_views_empty_project_instructions_spec.rb | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/features/projects/developer_views_empty_project_instructions_spec.rb b/spec/features/projects/developer_views_empty_project_instructions_spec.rb new file mode 100644 index 00000000000..0c51fe72ca4 --- /dev/null +++ b/spec/features/projects/developer_views_empty_project_instructions_spec.rb @@ -0,0 +1,63 @@ +require 'rails_helper' + +feature 'Developer views empty project instructions', feature: true do + let(:project) { create(:empty_project, :empty_repo) } + let(:developer) { create(:user) } + + background do + project.team << [developer, :developer] + + login_as(developer) + end + + context 'without an SSH key' do + scenario 'defaults to HTTP' do + visit_project + + expect_instructions_for('http') + end + + scenario 'switches to SSH', js: true do + visit_project + + select_protocol('SSH') + + expect_instructions_for('ssh') + end + end + + context 'with an SSH key' do + background do + create(:personal_key, user: developer) + end + + scenario 'defaults to SSH' do + visit_project + + expect_instructions_for('ssh') + end + + scenario 'switches to HTTP', js: true do + visit_project + + select_protocol('HTTP') + + expect_instructions_for('http') + end + end + + def visit_project + visit namespace_project_path(project.namespace, project) + end + + def select_protocol(protocol) + find('#clone-dropdown').click + find(".#{protocol.downcase}-selector").click + end + + def expect_instructions_for(protocol) + msg = :"#{protocol.downcase}_url_to_repo" + + expect(page).to have_content("git clone #{project.send(msg)}") + end +end |