Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
065e2f9d5453
Commit
307f0591
authored
May 15, 2018
by
Jacopo
Browse files
Fixes 500 error on /estimate BIG_VALUE
parent
ba2b184b2881
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/models/concerns/time_trackable.rb
View file @
065e2f9d
...
...
@@ -53,6 +53,10 @@ def human_time_estimate
Gitlab
::
TimeTrackingFormatter
.
output
(
time_estimate
)
end
def
time_estimate
=
(
val
)
val
.
is_a?
(
Integer
)
?
super
([
val
,
Gitlab
::
Database
::
MAX_INT_VALUE
].
min
)
:
super
(
val
)
end
private
def
touchable?
...
...
changelogs/unreleased/46193-fix-big-estimate.yml
0 → 100644
View file @
065e2f9d
---
title
:
Fixes 500 error on /estimate BIG_VALUE
merge_request
:
18964
author
:
Jacopo Beschi @jacopo-beschi
type
:
fixed
spec/models/concerns/issuable_spec.rb
View file @
065e2f9d
...
...
@@ -266,6 +266,19 @@
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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment