summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-01 15:58:06 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-03 02:11:50 +0900
commitfd302061f915f535b2dd419d5a76efb76ab534be (patch)
treec982fbf7d0a26336b63c395978c1cad9d978700c /spec/finders
parentdf834306c1794ed72d6d655c7941dee28f7e85c7 (diff)
downloadgitlab-ce-fd302061f915f535b2dd419d5a76efb76ab534be.tar.gz
Fix rubocop offences and rspec failures
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/pipelines_finder_spec.rb45
1 files changed, 22 insertions, 23 deletions
diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb
index 3bb828000d4..336901d0264 100644
--- a/spec/finders/pipelines_finder_spec.rb
+++ b/spec/finders/pipelines_finder_spec.rb
@@ -34,16 +34,15 @@ describe PipelinesFinder do
end
it 'orders in descending order on ID' do
- expected_ids = [
- tag_pipeline.id,
- created_pipeline.id,
- pending_pipeline.id,
- running_pipeline.id,
- success_pipeline.id,
- failed_pipeline.id,
- canceled_pipeline.id,
- skipped_pipeline.id,
- yaml_errors_pipeline.id].sort.reverse
+ expected_ids = [tag_pipeline.id,
+ created_pipeline.id,
+ pending_pipeline.id,
+ running_pipeline.id,
+ success_pipeline.id,
+ failed_pipeline.id,
+ canceled_pipeline.id,
+ skipped_pipeline.id,
+ yaml_errors_pipeline.id].sort.reverse
expect(subject.map(&:id)).to eq expected_ids
end
end
@@ -214,21 +213,21 @@ describe PipelinesFinder do
end
context 'when a order_by and sort are passed' do
- context 'when order by started_at asc' do
+ context 'when order by created_at asc' do
let(:params) { { order_by: 'created_at', sort: 'asc' } }
- it 'sorts by started_at asc' do
- expected_created_at = [
- tag_pipeline.created_at,
- created_pipeline.created_at,
- pending_pipeline.created_at,
- running_pipeline.created_at,
- success_pipeline.created_at,
- failed_pipeline.created_at,
- canceled_pipeline.created_at,
- skipped_pipeline.created_at,
- yaml_errors_pipeline.created_at].sort
- expect(subject.map(&:created_at)).to eq expected_created_at
+ it 'sorts by created_at asc' do
+ expect(subject.first).to eq(tag_pipeline)
+ expect(subject.last).to eq(yaml_errors_pipeline)
+ end
+ end
+
+ context 'when order by created_at desc' do
+ let(:params) { { order_by: 'created_at', sort: 'desc' } }
+
+ it 'sorts by created_at desc' do
+ expect(subject.first).to eq(yaml_errors_pipeline)
+ expect(subject.last).to eq(tag_pipeline)
end
end
end