Commit f50ee65b authored by Stan Hu's avatar Stan Hu

Add spec for HTTP/SSH clone panel

parent 4a8b4d8a
......@@ -104,10 +104,14 @@ describe 'Project' do
let(:path) { project_path(project) }
before do
stub_application_setting(enabled_git_access_protocol: enabled_protocols)
sign_in(create(:admin))
visit path
end
context 'with all protocols enabled' do
let(:enabled_protocols) { nil }
context 'desktop component' do
it 'shows on md and larger breakpoints' do
expect(find('.git-clone-holder')).to be_visible
......@@ -124,6 +128,33 @@ describe 'Project' do
end
end
context 'when only HTTP clones are allowed' do
let(:enabled_protocols) { 'http' }
it 'shows only the instructions for HTTP' do
find('.clone-dropdown-btn').click
within('.git-clone-holder') do
expect(page).to have_content('Clone with HTTP')
expect(page).not_to have_content('Clone with SSH')
end
end
end
context 'when only SSH clones are allowed' do
let(:enabled_protocols) { 'ssh' }
it 'shows only the instructions for SSH' do
find('.clone-dropdown-btn').click
within('.git-clone-holder') do
expect(page).to have_content('Clone with SSH')
expect(page).not_to have_content('Clone with HTTP')
end
end
end
end
describe 'remove forked relationship', :js do
let(:user) { create(:user) }
let(:project) { fork_project(create(:project, :public), user, namespace_id: user.namespace) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment