Use order instead of reorder. Improve tests.
This commit is contained in:
parent
8f32724fcb
commit
98ac988d4d
2 changed files with 6 additions and 3 deletions
|
@ -118,6 +118,6 @@ class PipelinesFinder
|
||||||
else
|
else
|
||||||
:desc
|
:desc
|
||||||
end
|
end
|
||||||
items.reorder(order_by => sort)
|
items.order(order_by => sort)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -225,8 +225,11 @@ describe API::Pipelines do
|
||||||
|
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
expect(response).to include_pagination_headers
|
expect(response).to include_pagination_headers
|
||||||
expect(json_response.first['id']).to eq(project.pipelines.order(user_id: :asc).first.id)
|
expect(json_response).not_to be_empty
|
||||||
expect(json_response.last['id']).to eq(project.pipelines.order(user_id: :asc).last.id)
|
pipelines = project.pipelines.order(user_id: :asc)
|
||||||
|
json_response.each_with_index do |r, i|
|
||||||
|
expect(r['id']).to eq(pipelines[i].id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue