Fix improper method name and spec description
This commit is contained in:
parent
c79c389525
commit
7fb3a78a6d
2 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue