Displaying 1 result from an estimated 1 matches for "mock_delegate".
2006 Oct 10
0
Is anybody using a block to verify arguments passed to an expectation?
...f 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 valid or not.
So, is anyone using it?  Any thoughts on what I'...