diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-05-05 00:05:16 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-05-05 00:05:16 +0300 |
commit | f18ec70743375024aa7ec7bb86c437ca9198e729 (patch) | |
tree | 4fe1fb68fbb9ced4ff5f5514f755916554d2d384 /spec/features/projects | |
parent | fad7b392dc633fb689e657af8b7fad346ede416e (diff) |
Backport changes from gitlab-org/gitlab-ee!372
Mostly replaces several Spinach tests with RSpec Feature tests.
Diffstat (limited to 'spec/features/projects')
-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 |