diff options
author | Robert Speicher <robert@gitlab.com> | 2018-01-05 17:53:31 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-01-16 17:04:38 -0800 |
commit | 8f4b06137577f868ffaa41d10c27aa1e763bc825 (patch) | |
tree | 26729d296b21930b17b1730292ac7d4ea59c9cc4 /spec/finders | |
parent | 6846b70dd499f5aeee6936b3f9604fe42cafe87a (diff) | |
download | gitlab-ce-8f4b06137577f868ffaa41d10c27aa1e763bc825.tar.gz |
Merge branch 'milestones-finder-order-fix' into 'security-10-3'
Remove order param from the MilestoneFinder
See merge request gitlab/gitlabhq!2259
(cherry picked from commit 14408042e78f2ebc2644f956621b461dbfa3d36d)
155881e7 Remove order param from the MilestoneFinder
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/milestones_finder_spec.rb | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/spec/finders/milestones_finder_spec.rb b/spec/finders/milestones_finder_spec.rb index 8ae08656e01..0b3cf7ece5f 100644 --- a/spec/finders/milestones_finder_spec.rb +++ b/spec/finders/milestones_finder_spec.rb @@ -21,10 +21,19 @@ describe MilestonesFinder do expect(result).to contain_exactly(milestone_1, milestone_2) end - it 'returns milestones for groups and projects' do - result = described_class.new(project_ids: [project_1.id, project_2.id], group_ids: group.id, state: 'all').execute + context 'milestones for groups and project' do + let(:result) do + described_class.new(project_ids: [project_1.id, project_2.id], group_ids: group.id, state: 'all').execute + end + + it 'returns milestones for groups and projects' do + expect(result).to contain_exactly(milestone_1, milestone_2, milestone_3, milestone_4) + end - expect(result).to contain_exactly(milestone_1, milestone_2, milestone_3, milestone_4) + it 'orders milestones by due date' do + expect(result.first).to eq(milestone_1) + expect(result.second).to eq(milestone_3) + end end context 'with filters' do @@ -61,30 +70,4 @@ describe MilestonesFinder do expect(result.to_a).to contain_exactly(milestone_1) end end - - context 'with order' do - let(:params) do - { - project_ids: [project_1.id, project_2.id], - group_ids: group.id, - state: 'all' - } - end - - it "default orders by due date" do - result = described_class.new(params).execute - - expect(result.first).to eq(milestone_1) - expect(result.second).to eq(milestone_3) - end - - it "orders by parameter" do - result = described_class.new(params.merge(order: 'id DESC')).execute - - expect(result.first).to eq(milestone_4) - expect(result.second).to eq(milestone_3) - expect(result.third).to eq(milestone_2) - expect(result.fourth).to eq(milestone_1) - end - end end |