On Sun, Aug 14, 2011 at 3:48 PM, John Hinnegan <john.hinne...@gmail.com>wrote:
> > > 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) > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users That *should* work. The before's in config are run before any before's in your specs. And as long as you're not using any other mocking framework, `.stub` should work as well. We'll need some more info to help you debug.
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users