On Wed, Dec 22, 2010 at 2:28 PM, Suman Gurung <sumangur...@gmail.com> wrote:
> 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.

RSpec.configure do |config|
  config.before(:each, :type => :controller) do
    # stub some methods
  end
end

HTH,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to