[rspec-users] stub in config.before

John Hinnegan john.hinnegan at gmail.com
Sun Aug 14 17:48:14 EDT 2011


I was trying to stub something "globally", across all tests today, and had
some trouble.

I tried

RSpec.configure do |config|
  config.before(:all) do
    MyClass.stub(:my_method)
  end
end

seems that stub is not available here yet.  (I was stubbing a class method,
and the class was loaded correctly).

Is there somewhere else I should be putting this?  At what point is the stub
code loaded?

(PS, the code I'm using in there works just fine in "proper" before blocks
inside describe blocks)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110814/d2044dea/attachment.html>


More information about the rspec-users mailing list