If I do
Klass.stub_any_instance(:new, raise(RuntimeError) do
...
end
the RuntimeError is raised at the stub_any_instance line and not, as I would like, later when a Klass.new() occurs.
Is there a way to make this work the way I would like?
If I do
Klass.stub_any_instance(:new, raise(RuntimeError) do
...
end
the RuntimeError is raised at the stub_any_instance line and not, as I would like, later when a Klass.new() occurs.
Is there a way to make this work the way I would like?
Wrap the
raisein a lambda:(You'll also want to use
stubrather thanstub_any_instance.)