diff options
author | Robert Speicher <robert@gitlab.com> | 2017-01-13 21:10:16 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-01-13 21:10:16 +0000 |
commit | 77756efc22af33dd1cdb16671e39192d5761eaf6 (patch) | |
tree | 5ac74e671f31fbc7c1b6e20831bfeedda48e7771 /spec | |
parent | e8538f7a42f63996cadfb124e9947c862cd86cb2 (diff) | |
parent | 0bc48797c8559a1f9c042b74e2faadc820fc7257 (diff) | |
download | gitlab-ce-77756efc22af33dd1cdb16671e39192d5761eaf6.tar.gz |
Merge branch 'fix-build-sort-order' into 'master'
Resolve "Sort order for pipeline build lists doesn't properly handle numbers"
Closes #25428
See merge request !8277
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/commit_status_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index 701f3323c0f..64ea607eb95 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -243,4 +243,23 @@ describe CommitStatus, models: true do .to be_a Gitlab::Ci::Status::Success end end + + describe '#sortable_name' do + tests = { + 'karma' => ['karma'], + 'karma 0 20' => ['karma ', 0, ' ', 20], + 'karma 10 20' => ['karma ', 10, ' ', 20], + 'karma 50:100' => ['karma ', 50, ':', 100], + 'karma 1.10' => ['karma ', 1, '.', 10], + 'karma 1.5.1' => ['karma ', 1, '.', 5, '.', 1], + 'karma 1 a' => ['karma ', 1, ' a'] + } + + tests.each do |name, sortable_name| + it "'#{name}' sorts as '#{sortable_name}'" do + commit_status.name = name + expect(commit_status.sortable_name).to eq(sortable_name) + end + end + end end |