summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-17 18:27:11 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-03 02:11:51 +0900
commit3735b8aaa1f48ea3803e31e18f1e40d2fd091b26 (patch)
tree10c868d3c1407c35fc4f14a7c107b557cf86a07f /spec/finders
parentf0e3076a32f1f127ef4d31b53979edd5e0218469 (diff)
downloadgitlab-ce-3735b8aaa1f48ea3803e31e18f1e40d2fd091b26.tar.gz
Allow only indexed columns in #order_and_sort. Remove present (Because unnecessary) from condition. Added spec just in case.
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/pipelines_finder_spec.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb
index 02422bb6ebc..02c91cbf465 100644
--- a/spec/finders/pipelines_finder_spec.rb
+++ b/spec/finders/pipelines_finder_spec.rb
@@ -208,7 +208,7 @@ describe PipelinesFinder do
context 'when order_by and sort are valid' do
let(:params) { { order_by: 'created_at', sort: 'asc' } }
- it 'sorts pipelines' do
+ it 'sorts pipelines by default' do
expect(subject).to eq(Ci::Pipeline.order(created_at: :asc))
end
end
@@ -228,6 +228,14 @@ describe PipelinesFinder do
expect(subject).to eq(Ci::Pipeline.order(created_at: :desc))
end
end
+
+ context 'when both are nil' do
+ let(:params) { { order_by: nil, sort: nil } }
+
+ it 'sorts pipelines by default' do
+ expect(subject).to eq(Ci::Pipeline.order(id: :desc))
+ end
+ end
end
end
end