diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-12-15 17:14:26 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-12-15 17:14:26 +0800 |
commit | 59ac184fcf64f1812fbfd88a00ea029ca3c1f4e7 (patch) | |
tree | 5db0594a6f568f02b4f54c6bf4eabe01229a9f95 /spec/helpers/labels_helper_spec.rb | |
parent | 85be6d83be4632c76760e373da131a90afb093b9 (diff) | |
parent | 1baea77438779e74657b49ca26810d6c8f041b41 (diff) | |
download | gitlab-ce-59ac184fcf64f1812fbfd88a00ea029ca3c1f4e7.tar.gz |
Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (671 commits)
Make rubocop happy
Use guard clause
Improve language
Prettify
Use temp branch
Pass info about who started the job and which job triggered it
Docs: add indexes for monitoring and performance monitoring
clearer-documentation-on-inline-diffs
Add docs for commit diff discussion in merge requests
sorting for tags api
Clear BatchLoader after each spec to prevent holding onto records longer than necessary
Include project in BatchLoader key to prevent returning blobs for the wrong project
moved lfs_blob_ids method into ExtractsPath module
Converted JS modules into exported modules
spec fixes
Bump gitlab-shell version to 5.10.3
Clear caches before updating MR diffs
Use new Ruby version 2.4 in GitLab QA images
moved lfs blob fetch from extractspath file
Update GitLab QA dependencies
...
Diffstat (limited to 'spec/helpers/labels_helper_spec.rb')
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index 4ac4302adfd..0286d36952c 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -1,6 +1,69 @@ require 'spec_helper' describe LabelsHelper do + describe '#show_label_issuables_link?' do + shared_examples 'a valid response to show_label_issuables_link?' do |issuables_type, when_enabled = true, when_disabled = false| + let(:context_project) { project } + + context "when asking for a #{issuables_type} link" do + subject { show_label_issuables_link?(label, issuables_type, project: context_project) } + + context "when #{issuables_type} are enabled for the project" do + let(:project) { create(:project, "#{issuables_type}_access_level": ProjectFeature::ENABLED) } + + it { is_expected.to be(when_enabled) } + end + + context "when #{issuables_type} are disabled for the project" do + let(:project) { create(:project, :public, "#{issuables_type}_access_level": ProjectFeature::DISABLED) } + + it { is_expected.to be(when_disabled) } + end + end + end + + context 'with a project label' do + let(:label) { create(:label, project: project, title: 'bug') } + + context 'when asking for an issue link' do + it_behaves_like 'a valid response to show_label_issuables_link?', :issues + end + + context 'when asking for a merge requests link' do + it_behaves_like 'a valid response to show_label_issuables_link?', :merge_requests + end + end + + context 'with a group label' do + set(:group) { create(:group) } + let(:label) { create(:group_label, group: group, title: 'bug') } + + context 'when asking for an issue link' do + context 'in the context of a project' do + it_behaves_like 'a valid response to show_label_issuables_link?', :issues, true, true + end + + context 'in the context of a group' do + let(:context_project) { nil } + + it_behaves_like 'a valid response to show_label_issuables_link?', :issues, true, true + end + end + + context 'when asking for a merge requests link' do + context 'in the context of a project' do + it_behaves_like 'a valid response to show_label_issuables_link?', :merge_requests, true, true + end + + context 'in the context of a group' do + let(:context_project) { nil } + + it_behaves_like 'a valid response to show_label_issuables_link?', :merge_requests, true, true + end + end + end + end + describe 'link_to_label' do let(:project) { create(:project) } let(:label) { create(:label, project: project) } |