def assert_yields(something_callable, arg)
yielded = false
something_callable.call(arg) do
yielded = true
end
assert yielded
end
# Called like:
assert_yields(some_obj.method(:do_something), my_arg)
One could easily make it handle a variable number of arguments.
No comments:
Post a Comment