2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Labels > User sees links to issuables' do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
label # creates the label
|
|
|
|
project.add_developer(user)
|
|
|
|
sign_in user
|
|
|
|
visit project_labels_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a project label' do
|
|
|
|
let(:label) { create(:label, project: project, title: 'bug') }
|
|
|
|
|
|
|
|
context 'when merge requests and issues are enabled for the project' do
|
|
|
|
let(:project) { create(:project, :public) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to MRs and issues' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).to have_link('Merge requests')
|
|
|
|
expect(page).to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when issues are disabled for the project' do
|
|
|
|
let(:project) { create(:project, :public, issues_access_level: ProjectFeature::DISABLED) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to MRs but not to issues' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).to have_link('Merge requests')
|
|
|
|
expect(page).not_to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when merge requests are disabled for the project' do
|
|
|
|
let(:project) { create(:project, :public, merge_requests_access_level: ProjectFeature::DISABLED) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to issues but not to MRs' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).not_to have_link('Merge requests')
|
|
|
|
expect(page).to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with a group label' do
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:group) { create(:group) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:label) { create(:group_label, group: group, title: 'bug') }
|
|
|
|
|
|
|
|
context 'when merge requests and issues are enabled for the project' do
|
|
|
|
let(:project) { create(:project, :public, namespace: group) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to MRs and issues' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).to have_link('Merge requests')
|
|
|
|
expect(page).to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when issues are disabled for the project' do
|
|
|
|
let(:project) { create(:project, :public, namespace: group, issues_access_level: ProjectFeature::DISABLED) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to MRs and issues' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).to have_link('Merge requests')
|
|
|
|
expect(page).to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when merge requests are disabled for the project' do
|
|
|
|
let(:project) { create(:project, :public, namespace: group, merge_requests_access_level: ProjectFeature::DISABLED) }
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'shows links to MRs and issues' do
|
2019-10-12 21:52:04 +05:30
|
|
|
page.within('.labels-container') do
|
|
|
|
expect(page).to have_link('Merge requests')
|
|
|
|
expect(page).to have_link('Issues')
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|