Commit 7fb3a78a authored by shinya maeda's avatar shinya maeda

Fix improper method name and spec description

parent c79c3895
......@@ -15,7 +15,7 @@ class PipelinesFinder
items = by_name(items)
items = by_username(items)
items = by_yaml_errors(items)
order_and_sort(items)
sort_items(items)
end
private
......@@ -107,7 +107,7 @@ class PipelinesFinder
end
end
def order_and_sort(items)
def sort_items(items)
order_by = if %w[id status ref user_id].include?(params[:order_by]) # Allow only indexed columns
params[:order_by]
else
......
......@@ -208,7 +208,7 @@ describe PipelinesFinder do
context 'when order_by and sort are valid' do
let(:params) { { order_by: 'user_id', sort: 'asc' } }
it 'sorts pipelines by default' do
it 'sorts pipelines' do
expect(subject).to eq(Ci::Pipeline.order(user_id: :asc))
end
end
......@@ -216,7 +216,7 @@ describe PipelinesFinder do
context 'when order_by is invalid' do
let(:params) { { order_by: 'invalid_column', sort: 'asc' } }
it 'sorts pipelines with default order_by (id:)' do
it 'sorts pipelines with id: (default)' do
expect(subject).to eq(Ci::Pipeline.order(id: :asc))
end
end
......@@ -224,7 +224,7 @@ describe PipelinesFinder do
context 'when sort is invalid' do
let(:params) { { order_by: 'user_id', sort: 'invalid_sort' } }
it 'sorts pipelines with default sort (:desc)' do
it 'sorts pipelines with :desc (default)' do
expect(subject).to eq(Ci::Pipeline.order(user_id: :desc))
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment