test/spec/api/helper/equality_test.rb in rspec-0.5.11 vs test/spec/api/helper/equality_test.rb in rspec-0.5.12
- old
+ new
@@ -23,10 +23,18 @@
def test_should_equal_should_raise_when_objects_are_not_equal
assert_raise(ExpectationNotMetError) do
@dummy.should.equal @another_dummy
end
end
+
+ def test_should_raise_nice_message
+ begin
+ "foo\nbar\nzap".should_equal "foo\nzap\nbar"
+ rescue ExpectationNotMetError => e
+ assert_equal "\"foo\\nbar\\nzap\" should equal \"foo\\nzap\\nbar\"", e.message
+ end
+ end
# should.not.equal
def test_should_not_equal_should_not_raise_when_objects_are_not_equal
assert_nothing_raised do
@@ -51,11 +59,17 @@
end
def test_should_be_close_failing_cases
assert_raise(ExpectationNotMetError) do
3.5.should.be.close 3.0, 0.5
+ end
+ assert_raise(ExpectationNotMetError) do
3.5.should.be.close 2.0, 0.5
+ end
+ assert_raise(ExpectationNotMetError) do
3.5.should.be.close 4.0, 0.5
+ end
+ assert_raise(ExpectationNotMetError) do
3.5.should.be.close 5.0, 0.5
end
end
end