test/measurable_test.rb in measured-2.8.2 vs test/measurable_test.rb in measured-3.0.0
- old
+ new
@@ -39,9 +39,13 @@
test "#initialize converts floats and strings to BigDecimal and does not round large numbers" do
assert_equal BigDecimal(9.1234572342342, 14), Magic.new(9.1234572342342, :fire).value
assert_equal BigDecimal("9.1234572342342"), Magic.new("9.1234572342342", :fire).value
end
+ test "#initialize converts strings to Rational if they follow Rational pattern" do
+ assert_equal Rational(1, 3), Magic.new("1/3", :fire).value
+ end
+
test "#initialize converts to the base unit" do
assert_equal @fireball, Magic.new(1, :fire).unit
end
test "#initialize raises an expected error when initializing with nil value" do