diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-17 17:23:32 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-17 17:23:32 +0000 |
commit | 4609a1268de9f15c02899c906cbb9ce27c495ab3 (patch) | |
tree | 69585303b6073bdb4ba07c721c219ab31682c39d /spec | |
parent | 7f7f8741847175537d534d2e1b39bd70a791a879 (diff) | |
parent | e4adf0150b58d0b7f8437cbb9a3cb3ac8aa31bec (diff) | |
download | gitlab-ce-4609a1268de9f15c02899c906cbb9ce27c495ab3.tar.gz |
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')
-rw-r--r-- | spec/models/concerns/issuable_spec.rb | 13 |
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 } |