From: Gregory Brown Date: 2007-07-03T08:52:47+09:00 Subject: Re: Testing for warnings On 7/2/07, Alex Gutteridge wrote: > I specifically need to check for warnings from C code so replacing > Kernel#warn won't work. I will try hooking into STDERR though - > thanks for the idea. Possibly make use of Mocha or another mocking framework? class Foo def bar warn "baz" end end require "test/unit" require "rubygems" require "mocha" class TestFoo < Test::Unit::TestCase def test_bar_should_warn a = Foo.new a.expects(:warn).with("baz") a.bar end end