From: "joe.yakich@..." Date: 2005-10-07T10:16:49+09:00 Subject: Enhancing/overriding Test::Unit::Assertion methods--what's the best way? Everyone, I have a little screen capture routine that I'd like to use automatically if possible when I use any of the Test::Unit assert flavors, such as assert, assert_equals, assert_match, etc. (whether or not the assertion returns true or false). Is there a spiffy way to override or enhance/extend Test::Unit to do that? (I'm new to Ruby, and haven't grasped what it means to extend it; I see in the PickAxe book there's mention of using C, but I think there's another way to accomplish what I'm describing.) Ideally, I'd be able to do this: assert(ie.contains_text('some_text') or this assert_match(/'s Web Page/, ie.title) and assert/assert_match would have been overridden (that's probably a poor choice of words, but it indicates what I'm naively hoping to accomplish) so that it automatically did something like this: def assert_with_screen_capture(params) capture_screen call_whatever_flavor_of_assert_I_wanted(params) end I was hoping to have a drop-in replacement so that existing code would only have to have another require/include line rather than changing each assert.* call to some custom one. Thanks in advance, hope I'm not overlooking something I should have seen. Joe