diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-05-28 10:05:20 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-05-28 10:05:20 +0000 |
commit | 4df0e2599bc9bd7c50b6acea02278c1fb97d3ead (patch) | |
tree | 9ec579188c4fe083d71da187c64277e3337df22b /spec/helpers | |
parent | 2d12e22299114490385693a57666d658f0909da7 (diff) | |
download | gitlab-ce-4df0e2599bc9bd7c50b6acea02278c1fb97d3ead.tar.gz |
Fix display of promote to group label
Since label presenter is used in label index view, label class
check doesn't work as expected because the class is now LabelPresenter.
Also `label.subject` doesn't work as expected now because Label's model
`subject` method is shadowed by Gitlab's presenter's method which uses
`subject` for referencing the original object.
Instead we use a presenter's method for both checks now.
`label_deletion_confirm_text` is not used anywhere so it's removed
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index 58eaf991d6e..314305d7a8e 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -6,7 +6,7 @@ describe LabelsHelper do let(:context_project) { project } context "when asking for a #{issuables_type} link" do - subject { show_label_issuables_link?(label, issuables_type, project: context_project) } + subject { show_label_issuables_link?(label.present(issuable_subject: nil), 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) } @@ -279,4 +279,21 @@ describe LabelsHelper do expect(label.color).to eq('bar') end end + + describe '#label_status_tooltip' do + let(:status) { 'unsubscribed'.inquiry } + subject { label_status_tooltip(label.present(issuable_subject: nil), status) } + + context 'with a project label' do + let(:label) { create(:label, title: 'bug') } + + it { is_expected.to eq('Subscribe at project level') } + end + + context 'with a group label' do + let(:label) { create(:group_label, title: 'bug') } + + it { is_expected.to eq('Subscribe at group level') } + end + end end |