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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -