test/measurable_test.rb in measured-1.3.1 vs test/measurable_test.rb in measured-1.4.0
- old
+ new
@@ -154,9 +154,14 @@
test "#inspect shows the number and the unit" do
assert_equal "#<Magic: 10.0 fireball>", Magic.new(10, :fire).inspect
assert_equal "#<Magic: 1.234 magic_missile>", Magic.new(1.234, :magic_missile).inspect
end
+ test "#zero? delegates to the value" do
+ assert Magic.new(0, :fire).zero?
+ refute Magic.new(2, :fire).zero?
+ end
+
test "#<=> compares regardless of the unit" do
assert_equal -1, @magic <=> Magic.new(10, :fire)
assert_equal 1, @magic <=> Magic.new(9, :magic_missile)
assert_equal 0, @magic <=> Magic.new(10, :magic_missile)
assert_equal -1, @magic <=> Magic.new(11, :magic_missile)