test/unit_test.rb in measured-2.1.0 vs test/unit_test.rb in measured-2.2.0
- old
+ new
@@ -53,25 +53,25 @@
assert Measured::Unit.ancestors.include?(Comparable)
end
test "#<=> compares non-Unit classes against name" do
assert_equal 1, @unit <=> "Pap"
- assert_equal -1, @unit <=> "Pop"
+ assert_equal (-1), @unit <=> "Pop"
end
test "#<=> is 0 for Unit instances that should be equivalent" do
assert_equal 0, @unit <=> Measured::Unit.new(:Pie, value: "10 cake")
assert_equal 0, @unit <=> Measured::Unit.new("Pie", value: "10 cake")
assert_equal 0, @unit <=> Measured::Unit.new("Pie", value: [10, :cake])
end
test "#<=> is -1 for units with names that come after Pie lexicographically" do
- assert_equal -1, @unit <=> Measured::Unit.new(:Pigs, value: "10 bacon")
- assert_equal -1, @unit <=> Measured::Unit.new("Pig", aliases: %w(Pigs), value: "10 bacon")
+ assert_equal (-1), @unit <=> Measured::Unit.new(:Pigs, value: "10 bacon")
+ assert_equal (-1), @unit <=> Measured::Unit.new("Pig", aliases: %w(Pigs), value: "10 bacon")
end
-
+
test "#<=> compares #conversion_amount when unit names the same" do
- assert_equal -1, @unit <=> Measured::Unit.new(:Pie, value: [11, :pancake])
+ assert_equal (-1), @unit <=> Measured::Unit.new(:Pie, value: [11, :pancake])
assert_equal 0, @unit <=> Measured::Unit.new(:Pie, value: [10, :foo])
assert_equal 1, @unit <=> Measured::Unit.new(:Pie, value: [9, :pancake])
end
test "#inverse_conversion_amount returns 1/amount" do