will define a method stub on any instance of a class for the duration of a block.
String.stub_any_instance(:length, 42) do
assert_equal "hello".length, 42 # this assertion passes!
actually extracted the code from SimpleForm to do the job, and suggested it be included in MiniTest itself
. But that didn't fly, so I packaged it as a plugin/gem.