diff options
Diffstat (limited to 'spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb new file mode 100644 index 00000000000..d3d2a36147d --- /dev/null +++ b/spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'User views Git access wiki page' do + let(:wiki_page) { create(:wiki_page, wiki: wiki) } + + before do + sign_in(user) + end + + it 'shows the correct clone URLs', :js do + visit wiki_page_path(wiki, wiki_page) + click_link 'Clone repository' + + expect(page).to have_text("Clone repository #{wiki.full_path}") + + within('.git-clone-holder') do + expect(page).to have_css('#clone-dropdown', text: 'HTTP') + expect(page).to have_field('clone_url', with: wiki.http_url_to_repo) + + click_link 'HTTP' # open the dropdown + click_link 'SSH' # select the dropdown item + + expect(page).to have_css('#clone-dropdown', text: 'SSH') + expect(page).to have_field('clone_url', with: wiki.ssh_url_to_repo) + end + end +end |