summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-10-28 11:50:43 +0000
committerStan Hu <stanhu@gmail.com>2016-10-28 23:26:08 -0700
commitef037519673c5619319793fbe922849b3ca1369b (patch)
tree18ffe107253ebdc51b4a6fda60a16f03d4ff6756 /spec/models
parentd31fa260d067bbdb1e3b6c82bbf1c01a5f66f54d (diff)
downloadgitlab-ce-ef037519673c5619319793fbe922849b3ca1369b.tar.gz
Merge branch '23928-sortable-highest_label_priority-is-bugged' into 'master'
Fix and improve `Sortable.highest_label_priority` Closes #23928 See merge request !7165
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/issuable_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index 60e4bbc8564..a59d30687f6 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -298,6 +298,20 @@ describe Issue, "Issuable" do
end
end
+ describe '.order_labels_priority' do
+ let(:label_1) { create(:label, title: 'label_1', project: issue.project, priority: 1) }
+ let(:label_2) { create(:label, title: 'label_2', project: issue.project, priority: 2) }
+
+ subject { Issue.order_labels_priority(excluded_labels: ['label_1']).first.highest_priority }
+
+ before do
+ issue.labels << label_1
+ issue.labels << label_2
+ end
+
+ it { is_expected.to eq(2) }
+ end
+
describe ".with_label" do
let(:project) { create(:project, :public) }
let(:bug) { create(:label, project: project, title: 'bug') }