Project

General

Profile

« Previous | Next » 

Revision fc2fc7ac

Added by Tomer Brisker over 7 years ago

Fixes #10957 - Correctly handle to_gb when no unit given

View differences:

test/unit/core_extensions_test.rb
assert(to_gb_value.is_a?(Float), "Converted value shoud be a float")
end
test '#to_gb with no units' do
value = '10.50'
assert_equal 10.5, value.to_gb.gigabytes, 'Converted value should be 10.5 bytes'
end
test '#to_gb for bytes' do
value = '0 Bytes'
to_gb_value = value.to_gb
......
end
test '#to_gb non matching string raises exception with correct message' do
value = 'something that is not matched'
value = '1 something that is not matched'
exception = assert_raises(RuntimeError) { value.to_gb }
assert exception.message =~ /^Unknown string/, "wrong exception reason #{exception}"
end

Also available in: Unified diff