From: Martin Hansen Date: 2010-05-11T19:27:14+09:00 Subject: Re: Unit Test of method calling system() - how? @Brian I have been looking at flexmock, but I guess the mocking method is not important - it is how?!? ... Especially since these are private methods. Perhaps the code should be rearranged? Cheers, Martin Brian Candler wrote: > Martin Hansen wrote: >> Ideas most welcome! > > class Foo > def bar > system("wibble") > end > end > > require 'test/unit' > require 'mocha' > class TestFoo < Test::Unit::TestCase > def test_foo > a = Foo.new > Foo.any_instance.expects(:system).with("wibble").returns("bibble") > assert_equal "bibble", a.bar > end > end -- Posted via http://www.ruby-forum.com/.