[rspec-users] any_instance

Sidu Ponnappa ckponnappa at gmail.com
Mon Nov 7 02:19:04 EST 2011

> Any clues as to what could be wrong?
It's either a bug or some other tests have side effects that only show
up when run together. Let me try to replicate it on one of my
codebases and get back to you.

Sidu Ponnappa.

On 3 November 2011 04:11, Bram <brambomail at gmail.com> wrote:
> Hello,
> I'm trying to stub out a method with the any_instance method, this
> works well if I run the spec individually however when I do a full run
> it will call the actual method:
> example "" do
>  Library::Class.any_instance.stub(:method).and_return true
>  Model.create
> end
> This will fire off the before_save method in ModelObserver and call
> Library::Class.method.
> running "bundle exec rspec spec/observer/model_observer.rb" works
> "bundle exec rspec" will call the actual method.
> Any clues as to what could be wrong?
> Thanks in advanced.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list