Fix rubocop issue of single- vs double- quotes (+1 squashed commit)
Squashed commits: [49cb03a3ce] Fix missing return from ActionView::Helpers::NumberHelper#parse_float, fixes #43853 Add test case for number helpers not raising exception when `raise: true` is passed and input is valid
This commit is contained in:
parent
85f45350e6
commit
3edada28fa
|
@ -450,6 +450,7 @@ module ActionView
|
|||
def parse_float(number, raise_error)
|
||||
result = Float(number, exception: false)
|
||||
raise InvalidNumberError, number if result.nil? && raise_error
|
||||
result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -201,4 +201,34 @@ class NumberHelperTest < ActionView::TestCase
|
|||
end
|
||||
assert_equal "x", exception.number
|
||||
end
|
||||
|
||||
def test_number_helpers_should_not_raise_error_if_valid_when_specified
|
||||
assert_nothing_raised do
|
||||
number_to_human("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_to_human_size("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_with_precision("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_to_currency("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_to_percentage("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_with_delimiter("3.33", raise: true)
|
||||
end
|
||||
|
||||
assert_nothing_raised do
|
||||
number_to_phone("3.33", raise: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue