Commit fda48d30 authored by Shinya Maeda's avatar Shinya Maeda

Improve api/pipelines_spec.rb

parent 7d48cb01
...@@ -28,10 +28,14 @@ describe PipelinesFinder do ...@@ -28,10 +28,14 @@ describe PipelinesFinder do
context 'when scope is finished' do context 'when scope is finished' do
let(:params) { { scope: 'finished' } } let(:params) { { scope: 'finished' } }
let!(:pipeline) { create(:ci_pipeline, project: project, status: 'success') } let!(:pipelines) do
[create(:ci_pipeline, project: project, status: 'success'),
create(:ci_pipeline, project: project, status: 'failed'),
create(:ci_pipeline, project: project, status: 'canceled')]
end
it 'returns matched pipelines' do it 'returns matched pipelines' do
is_expected.to eq([pipeline]) is_expected.to eq(pipelines.sort_by { |p| -p.id })
end end
end end
...@@ -168,7 +172,7 @@ describe PipelinesFinder do ...@@ -168,7 +172,7 @@ describe PipelinesFinder do
let(:params) { { order_by: 'user_id', sort: 'asc' } } let(:params) { { order_by: 'user_id', sort: 'asc' } }
let!(:pipelines) { create_list(:ci_pipeline, 2, project: project, user: create(:user)) } let!(:pipelines) { create_list(:ci_pipeline, 2, project: project, user: create(:user)) }
it 'sorts as user_id: :desc' do it 'sorts as user_id: :asc' do
is_expected.to eq(pipelines.sort_by { |p| p.user.id }) is_expected.to eq(pipelines.sort_by { |p| p.user.id })
end end
......
This diff is collapsed.
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