Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-05-17 20:23:32 +0300
committerRémy Coutable <remy@rymai.me>2018-05-17 20:23:32 +0300
commit4609a1268de9f15c02899c906cbb9ce27c495ab3 (patch)
tree69585303b6073bdb4ba07c721c219ab31682c39d /spec/models
parent7f7f8741847175537d534d2e1b39bd70a791a879 (diff)
parente4adf0150b58d0b7f8437cbb9a3cb3ac8aa31bec (diff)
Merge branch '46193-fix-big-estimate' into 'master'
Resolve "Estimating a large amount results in a server error 500" Closes #46193 See merge request gitlab-org/gitlab-ce!18964
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/issuable_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index 3d3092b8ac9..bd6bf5b0712 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -266,6 +266,19 @@ describe Issuable do
end
end
+ describe '#time_estimate=' do
+ it 'coerces the value below Gitlab::Database::MAX_INT_VALUE' do
+ expect { issue.time_estimate = 100 }.to change { issue.time_estimate }.to(100)
+ expect { issue.time_estimate = Gitlab::Database::MAX_INT_VALUE + 100 }.to change { issue.time_estimate }.to(Gitlab::Database::MAX_INT_VALUE)
+ end
+
+ it 'skips coercion for not Integer values' do
+ expect { issue.time_estimate = nil }.to change { issue.time_estimate }.to(nil)
+ expect { issue.time_estimate = 'invalid time' }.not_to raise_error(StandardError)
+ expect { issue.time_estimate = 22.33 }.not_to raise_error(StandardError)
+ end
+ end
+
describe '#to_hook_data' do
let(:builder) { double }