2017-04-18 16:49:52 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-06 06:58:24 -04:00
|
|
|
describe 'layouts/nav/sidebar/_project' do
|
2017-09-13 06:08:48 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:project, project)
|
|
|
|
assign(:repository, project.repository)
|
|
|
|
allow(view).to receive(:current_ref).and_return('master')
|
|
|
|
|
|
|
|
allow(view).to receive(:can?).and_return(true)
|
|
|
|
end
|
|
|
|
|
2019-01-29 23:42:50 -05:00
|
|
|
it_behaves_like 'has nav sidebar'
|
|
|
|
|
2017-09-13 06:08:48 -04:00
|
|
|
describe 'issue boards' do
|
2018-02-19 14:06:16 -05:00
|
|
|
it 'has board tab' do
|
2017-09-13 06:08:48 -04:00
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_css('a[title="Board"]')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-04-18 16:49:52 -04:00
|
|
|
describe 'container registry tab' do
|
|
|
|
before do
|
|
|
|
stub_container_registry_config(enabled: true)
|
|
|
|
|
|
|
|
allow(controller).to receive(:controller_name)
|
|
|
|
.and_return('repositories')
|
|
|
|
allow(controller).to receive(:controller_path)
|
|
|
|
.and_return('projects/registry/repositories')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'has both Registry and Repository tabs' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_text 'Repository'
|
|
|
|
expect(rendered).to have_text 'Registry'
|
|
|
|
end
|
|
|
|
|
2018-05-16 07:16:33 -04:00
|
|
|
it 'highlights sidebar item and flyout' do
|
2017-04-18 16:49:52 -04:00
|
|
|
render
|
|
|
|
|
2018-05-16 07:16:33 -04:00
|
|
|
expect(rendered).to have_css('.sidebar-top-level-items > li.active', count: 1)
|
|
|
|
expect(rendered).to have_css('.is-fly-out-only > li.active', count: 1)
|
2017-04-18 16:49:52 -04:00
|
|
|
end
|
|
|
|
|
2018-05-16 07:16:33 -04:00
|
|
|
it 'highlights container registry tab' do
|
2017-04-18 16:49:52 -04:00
|
|
|
render
|
|
|
|
|
2018-05-16 07:16:33 -04:00
|
|
|
expect(rendered).to have_css('.sidebar-top-level-items > li.active', text: 'Registry')
|
2017-04-18 16:49:52 -04:00
|
|
|
end
|
|
|
|
end
|
2018-12-10 07:03:00 -05:00
|
|
|
|
|
|
|
describe 'releases entry' do
|
2019-01-08 03:44:27 -05:00
|
|
|
it 'renders releases link' do
|
|
|
|
render
|
2018-12-10 07:03:00 -05:00
|
|
|
|
2019-01-08 03:44:27 -05:00
|
|
|
expect(rendered).to have_link('Releases', href: project_releases_path(project))
|
2018-12-10 07:03:00 -05:00
|
|
|
end
|
|
|
|
end
|
2019-01-09 10:05:52 -05:00
|
|
|
|
|
|
|
describe 'wiki entry tab' do
|
|
|
|
let(:can_read_wiki) { true }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:can?).with(nil, :read_wiki, project).and_return(can_read_wiki)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when wiki is enabled' do
|
|
|
|
it 'shows the wiki tab with the wiki internal link' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link('Wiki', href: project_wiki_path(project, :home))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when wiki is disabled' do
|
|
|
|
let(:can_read_wiki) { false }
|
|
|
|
|
|
|
|
it 'does not show the wiki tab' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_link('Wiki', href: project_wiki_path(project, :home))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'external wiki entry tab' do
|
|
|
|
let(:properties) { { 'external_wiki_url' => 'https://gitlab.com' } }
|
|
|
|
let(:service_status) { true }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.create_external_wiki_service(active: service_status, properties: properties)
|
|
|
|
project.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when it is active' do
|
|
|
|
it 'shows the external wiki tab with the external wiki service link' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_link('External Wiki', href: properties['external_wiki_url'])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when it is disabled' do
|
|
|
|
let(:service_status) { false }
|
|
|
|
|
|
|
|
it 'does not show the external wiki tab' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).not_to have_link('External Wiki', href: project_wiki_path(project, :home))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-04-18 16:49:52 -04:00
|
|
|
end
|