Re: [rspec-users] Stubs and Object Constructor

2011-03-23 Thread andyl
Pat and David - Thanks for taking the time to explain this. Look forward to seeing any_instance in rspec/mocks. And I will try to use it as little as possible! ;-) - Andy ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org

Re: [rspec-users] Stubs and Object Constructor

2011-03-23 Thread David Chelimsky
On Mar 20, 2011, at 11:38 PM, andyl wrote: > OK - I got this working using mocha and the 'any_instance' method. > > A gist with working examples is here: https://gist.github.com/879029 > > It looks like rspec mocks had an 'any_instance' method, but it was removed > because it promoted 'bad pr

Re: [rspec-users] Stubs and Object Constructor

2011-03-23 Thread Pat Maddox
On Mar 20, 2011, at 9:38 PM, andyl wrote: > OK - I got this working using mocha and the 'any_instance' method. > > A gist with working examples is here: https://gist.github.com/879029 > > It looks like rspec mocks had an 'any_instance' method, but it was removed > because it promoted 'bad pra

Re: [rspec-users] Stubs and Object Constructor

2011-03-22 Thread andyl
OK - I got this working using mocha and the 'any_instance' method. A gist with working examples is here: https://gist.github.com/879029 It looks like rspec mocks had an 'any_instance' method, but it was removed because it promoted 'bad practice'. I'm curious to understand how 'any_instance' p

Re: [rspec-users] Stubs and Object Constructor

2011-03-22 Thread andyl
PS: I'm using rspec/rspec-mocks 2.5, Ubuntu 10.10, Ruby 1.8.7 ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Stubs and Object Constructor

2011-03-22 Thread andyl
I'm having trouble using stubs to intercept method calls in the object constructor. Here's some code with a failing example: class Test2 attr_accessor :msg def initialize @msg = sayhi end def sayhi "hi" end end describe Test2, "stubbing