diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-09-17 13:35:39 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-09-18 11:35:21 -0300 |
commit | ec14d3fe3432b103230ec2c1f16678cf71236fbe (patch) | |
tree | 4684959e077b842e0e00c2351f710ab76053bf66 /spec | |
parent | a2a00a5e6d1ba3d2ebfafcff57e211cb1b65c00a (diff) | |
download | gitlab-ce-ec14d3fe3432b103230ec2c1f16678cf71236fbe.tar.gz |
Don't use MilestoneFinder for group milestones
This refactors the DashboardGroupMilestone model so that it no
longer uses the MilestoneFinder, instead using methods defined
on the Milestone model directly.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/milestone_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index 55b984faecf..27d4e622710 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -95,6 +95,24 @@ describe Milestone do end end + describe '.order_by_name_asc' do + it 'sorts by name ascending' do + milestone1 = create(:milestone, title: 'Foo') + milestone2 = create(:milestone, title: 'Bar') + + expect(described_class.order_by_name_asc).to eq([milestone2, milestone1]) + end + end + + describe '.reorder_by_due_date_asc' do + it 'reorders the input relation' do + milestone1 = create(:milestone, due_date: Date.new(2018, 9, 30)) + milestone2 = create(:milestone, due_date: Date.new(2018, 10, 20)) + + expect(described_class.reorder_by_due_date_asc).to eq([milestone1, milestone2]) + end + end + describe "#percent_complete" do it "does not count open issues" do milestone.issues << issue |