summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-05-15 12:40:17 +0200
committerJacopo <beschi.jacopo@gmail.com>2018-05-17 18:23:26 +0200
commite4adf0150b58d0b7f8437cbb9a3cb3ac8aa31bec (patch)
tree54c598a649baf877648be92b6502f26e24eae02e /spec
parent3a1843f9470e8916d65e182f33c1e5f53b217140 (diff)
downloadgitlab-ce-e4adf0150b58d0b7f8437cbb9a3cb3ac8aa31bec.tar.gz
Fixes 500 error on /estimate BIG_VALUE
Diffstat (limited to 'spec')
-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 }