summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-02-21 18:06:14 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-02-21 22:19:24 +0200
commit0a11d5e24559d9e22a3e9ab7311646f762a13562 (patch)
treed737114f2140d04b9e44f71cbbf138a212b0eb35 /spec/helpers
parentc8bf9f78f3e481cb7e74384fa45b46b864fa523a (diff)
downloadgitlab-ce-0a11d5e24559d9e22a3e9ab7311646f762a13562.tar.gz
Sort labels alphabetically
Sorts labels alphabetically on issues (and merge requests) list. Before it was order id desc. Now it will be consistent with sidebar and labels page. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/labels_helper_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb
index c04f679bcf0..012678db9c2 100644
--- a/spec/helpers/labels_helper_spec.rb
+++ b/spec/helpers/labels_helper_spec.rb
@@ -236,4 +236,17 @@ describe LabelsHelper do
expect(labels_filter_path(format: :json)).to eq(dashboard_labels_path(format: :json))
end
end
+
+ describe 'labels_sorted_by_title' do
+ it 'sorts labels alphabetically' do
+ label1 = double(:label, title: 'a')
+ label2 = double(:label, title: 'B')
+ label3 = double(:label, title: 'c')
+ label4 = double(:label, title: 'D')
+ labels = [label1, label2, label3, label4]
+
+ expect(labels_sorted_by_title(labels))
+ .to match_array([label2, label4, label1, label3])
+ end
+ end
end