Changing a variable when Ruby unit test fails -
i using ruby unit test in code below.
assert_equal(x, 'strin')
i want change variable if test fails , test should still fail. how can that? did same in python using following code.
try: self.assertequal(self.client.teststring(''), '') except assertionerror, e: test_basetypes_fails = true raise assertionerror( e.args )
the #assert_equal
method in ruby's test/unit
library raises test::unit::assertionfailederror
or (minitest::assertion
in ruby 1.9.3 or later) on failed assertions, so:
begin assert_equal(x, 'strin') rescue test::unit::assertionfailederror # whatever code raise end
Comments
Post a Comment