Commit 4fe7c255 authored by Shinya Maeda's avatar Shinya Maeda

Improve pipelines_finder.rb

parent 255bfd65
...@@ -11,7 +11,7 @@ describe PipelinesFinder do ...@@ -11,7 +11,7 @@ describe PipelinesFinder do
let!(:pipelines) { create_list(:ci_pipeline, 2, project: project) } let!(:pipelines) { create_list(:ci_pipeline, 2, project: project) }
it 'returns all pipelines' do it 'returns all pipelines' do
is_expected.to eq(pipelines.sort_by { |p| -p.id }) is_expected.to match_array(pipelines)
end end
end end
...@@ -35,7 +35,7 @@ describe PipelinesFinder do ...@@ -35,7 +35,7 @@ describe PipelinesFinder do
end end
it 'returns matched pipelines' do it 'returns matched pipelines' do
is_expected.to eq(pipelines.sort_by { |p| -p.id }) is_expected.to match_array(pipelines)
end end
end end
...@@ -162,7 +162,7 @@ describe PipelinesFinder do ...@@ -162,7 +162,7 @@ describe PipelinesFinder do
let(:params) { { yaml_errors: "invalid-yaml_errors" } } let(:params) { { yaml_errors: "invalid-yaml_errors" } }
it 'returns all pipelines' do it 'returns all pipelines' do
is_expected.to eq([pipeline1, pipeline2].sort_by { |p| -p.id }) is_expected.to match_array([pipeline1, pipeline2])
end end
end end
end end
...@@ -173,7 +173,7 @@ describe PipelinesFinder do ...@@ -173,7 +173,7 @@ describe PipelinesFinder do
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: :asc' do it 'sorts as user_id: :asc' do
is_expected.to eq(pipelines.sort_by { |p| p.user.id }) is_expected.to match_array(pipelines)
end end
context 'when sort is invalid' do context 'when sort is invalid' do
......
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