spec/spy/any_instance_spec.rb in spy-0.2.4 vs spec/spy/any_instance_spec.rb in spy-0.2.5
- old
+ new
@@ -442,29 +442,29 @@
end
end
context 'when used in conjunction with a `dup`' do
it "doesn't cause an infinite loop" do
- Object.any_instance.stub(:some_method)
+ Spy::Subroutine.new(Object, :some_method, false).hook(force: true)
o = Object.new
o.some_method
expect { o.dup.some_method }.to_not raise_error(SystemStackError)
end
it "doesn't bomb if the object doesn't support `dup`" do
klass = Class.new do
undef_method :dup
end
- klass.any_instance
+ Spy::Subroutine.new(Object, :some_method, false).hook(force: true)
end
it "doesn't fail when dup accepts parameters" do
klass = Class.new do
def dup(funky_option)
end
end
- klass.any_instance
+ Spy::Subroutine.new(Object, :some_method, false).hook(force: true)
expect { klass.new.dup('Dup dup dup') }.to_not raise_error(ArgumentError)
end
end