summaryrefslogtreecommitdiff
path: root/spec/models/concerns
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 15:09:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 15:09:56 +0000
commitc08d9c22569d1c9e7c7737e183969593394133d9 (patch)
tree8ce1722f852f8921656080e04f6c9e16fa71ddb5 /spec/models/concerns
parent546ddc3f6ac96fdf09934390a938bb391d07dc94 (diff)
downloadgitlab-ce-c08d9c22569d1c9e7c7737e183969593394133d9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/milestoneish_spec.rb45
1 files changed, 40 insertions, 5 deletions
diff --git a/spec/models/concerns/milestoneish_spec.rb b/spec/models/concerns/milestoneish_spec.rb
index 5808d6e37e5..81f173cd23a 100644
--- a/spec/models/concerns/milestoneish_spec.rb
+++ b/spec/models/concerns/milestoneish_spec.rb
@@ -302,20 +302,55 @@ describe Milestone, 'Milestoneish' do
end
end
- describe '#total_issue_time_spent' do
- it 'calculates total issue time spent' do
+ describe '#total_time_spent' do
+ it 'calculates total time spent' do
closed_issue_1.spend_time(duration: 300, user_id: author.id)
closed_issue_1.save!
closed_issue_2.spend_time(duration: 600, user_id: assignee.id)
closed_issue_2.save!
- expect(milestone.total_issue_time_spent).to eq(900)
+ expect(milestone.total_time_spent).to eq(900)
+ end
+
+ it 'includes merge request time spent' do
+ closed_issue_1.spend_time(duration: 300, user_id: author.id)
+ closed_issue_1.save!
+ merge_request.spend_time(duration: 900, user_id: author.id)
+ merge_request.save!
+
+ expect(milestone.total_time_spent).to eq(1200)
+ end
+ end
+
+ describe '#human_total_time_spent' do
+ it 'returns nil if no time has been spent' do
+ expect(milestone.human_total_time_spent).to be_nil
+ end
+ end
+
+ describe '#total_time_estimate' do
+ it 'calculates total estimate' do
+ closed_issue_1.time_estimate = 300
+ closed_issue_1.save!
+ closed_issue_2.time_estimate = 600
+ closed_issue_2.save!
+
+ expect(milestone.total_time_estimate).to eq(900)
+ end
+
+ it 'includes merge request time estimate' do
+ closed_issue_1.time_estimate = 300
+ closed_issue_1.save!
+ merge_request.time_estimate = 900
+ merge_request.save!
+
+ expect(milestone.total_time_estimate).to eq(1200)
end
end
- describe '#human_total_issue_time_spent' do
+ describe '#human_total_time_estimate' do
it 'returns nil if no time has been spent' do
- expect(milestone.human_total_issue_time_spent).to be_nil
+ expect(milestone.human_total_time_estimate).to be_nil
end
end
end