summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/features/wiki/user_git_access_wiki_page_shared_examples.rb
blob: d3d2a36147db660931e887d3af0ee608b008939c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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