Forum: RSpec any_instance

Posted by Bram Wijnands (bram__)
on 2011-11-06 19:03
(Received via mailing list)
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.
Posted by Sidu Ponnappa (kaiwren)
on 2011-11-07 08:26
(Received via mailing list)
> 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.

Best,
Sidu Ponnappa.
http://c42.in
http://rubymonk.com
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.