On Fri, Apr 1, 2011 at 8:34 AM, Peter Boling <peter.bol...@gmail.com> wrote:

> The before and after :suite hooks work for running code before and after
> rspec runs all the tests specified, but I need it to explicitly *not run* when
> anything less than every single spec is being run.  In other words is we are
> running rspec spec or rake spec I need this before and after :suite hooks to
> run (to clean-up VCR cassettes).  If we are not running the full suite, then
> it would mistakenly delete the VCR cassettes that were not used by the spec
> run.
>
> So I need it to not run the before and after :suite code if running, for
> example, rake spec:models or rspec spec/controllers.  I am not sure if
> rspec, or spec helper is aware of the full test suite being run.  ARGV won't
> work because when rake spec runs it executes rspec with every individual
> spec's path, so there is no way to tell from ARGV if it is the full suite,
> without getting really hacky.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


You could make your own task that depends on "spec":

task :task_to_run_all_spec_and_do_something_with_vcr => :spec do
  # my VCR code
end

Obviously, this wouldn't work with "rspec spec"
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to