[rspec-users] Stubbing out common setup

Suman Gurung sumangurung at gmail.com
Wed Dec 22 14:28:08 EST 2010


I want to stub an after save method(which generates files and so, is
time consuming), for most of my spec files apart from a few where that
method is actually tested.
I was trying to do this with using shared examples but with rspec 2, i
believe before(:each) defined in the shared examples are automatically
wrapped inside a 'context' in the host class.

What would be a good way to include a setup like this in more than one
spec files?

before(:each) do
  stub some methods
end

What I am trying to achieve is not to have the above code in all my
spec files.


More information about the rspec-users mailing list