Module: RSpecCandy::Helpers::StubAnyInstance
- Defined in:
- lib/rspec_candy/helpers/stub_any_instance.rb
Instance Method Summary collapse
Instance Method Details
#stub_any_instance(stubs) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rspec_candy/helpers/stub_any_instance.rb', line 5 def stub_any_instance(stubs) case Switcher.rspec_version when 1 unstubbed_new = method(:new) stub(:new).and_return do |*args| unstubbed_new.call(*args).tap do |obj| obj.stub stubs end end stubs else any_instance.stub(stubs) end end |