summaryrefslogtreecommitdiff
path: root/spec/features/projects/labels/user_sees_links_to_issuables.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-12-12 16:45:49 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-12-12 16:45:49 +0000
commitad1c186ed386afab578668ccdc21cb02354c81bc (patch)
tree5751194f943b6b555ff046b13d46a6d654139776 /spec/features/projects/labels/user_sees_links_to_issuables.rb
parentb655a4a790b05f6023563b35a3823728480c33fc (diff)
parent7ccd6a51a529452cdbd1d39121b067b773fcb170 (diff)
downloadgitlab-ce-ad1c186ed386afab578668ccdc21cb02354c81bc.tar.gz
Merge branch 'sophie-h/gitlab-ce-patch-15' into 'master'pawel/update-prometheus_gem_to_highly_optimized_version
Hide issues and MRs in labels list if disabled See merge request gitlab-org/gitlab-ce!15863
Diffstat (limited to 'spec/features/projects/labels/user_sees_links_to_issuables.rb')
-rw-r--r--spec/features/projects/labels/user_sees_links_to_issuables.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/spec/features/projects/labels/user_sees_links_to_issuables.rb b/spec/features/projects/labels/user_sees_links_to_issuables.rb
new file mode 100644
index 00000000000..aa56fd7f74e
--- /dev/null
+++ b/spec/features/projects/labels/user_sees_links_to_issuables.rb
@@ -0,0 +1,75 @@
+require 'spec_helper'
+
+feature 'Projects > Labels > User sees links to issuables' do
+ set(:user) { create(:user) }
+
+ 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) }
+
+ scenario 'shows links to MRs and issues' do
+ expect(page).to have_link('view merge requests')
+ expect(page).to have_link('view open issues')
+ end
+ end
+
+ context 'when issues are disabled for the project' do
+ let(:project) { create(:project, :public, issues_access_level: ProjectFeature::DISABLED) }
+
+ scenario 'shows links to MRs but not to issues' do
+ expect(page).to have_link('view merge requests')
+ expect(page).not_to have_link('view open issues')
+ end
+ end
+
+ context 'when merge requests are disabled for the project' do
+ let(:project) { create(:project, :public, merge_requests_access_level: ProjectFeature::DISABLED) }
+
+ scenario 'shows links to issues but not to MRs' do
+ expect(page).not_to have_link('view merge requests')
+ expect(page).to have_link('view open issues')
+ end
+ end
+ end
+
+ context 'with a group label' do
+ set(:group) { create(:group) }
+ 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) }
+
+ scenario 'shows links to MRs and issues' do
+ expect(page).to have_link('view merge requests')
+ expect(page).to have_link('view open issues')
+ end
+ end
+
+ context 'when issues are disabled for the project' do
+ let(:project) { create(:project, :public, namespace: group, issues_access_level: ProjectFeature::DISABLED) }
+
+ scenario 'shows links to MRs and issues' do
+ expect(page).to have_link('view merge requests')
+ expect(page).to have_link('view open issues')
+ 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) }
+
+ scenario 'shows links to MRs and issues' do
+ expect(page).to have_link('view merge requests')
+ expect(page).to have_link('view open issues')
+ end
+ end
+ end
+end