search for: test_should_delegate

Displaying 1 result from an estimated 1 matches for "test_should_delegate".

2006 Oct 10
0
Is anybody using a block to verify arguments passed to an expectation?
...ion would be with a method that delegates directly to another object. def delegate(delegate, method_sym, *args, &blk) delegate.__send__(method_sym, *args, &blk) end I''d like to have the following test that ensures I am correctly passing all arguments to my delegate object. def test_should_delegate method_sym = :foo args = [1, 2] blk = lambda {} mock_delegate = mock mock_delegate.expects(method_sym).with(*args, &blk) delegate(mock_delegate, method_sym, *args, &blk) end This currently fails because Expectation#with evaluates the block to determine whether the expectation is vali...