Spec_helper aware of full test suite being run? After hook to run code after running all specs?

I use VCR to record interactions, and when the recordings change
and directory structure, over time, as the test suite evolves, the old
recordings, no longer used, are rarely pruned.

I would like to have the ability to run rspec with an option to check
unused VCR recordings, and another to both check and delete unused

I need a way to know if the full spec suite is being run. I think this
be determined with some fancy testing on ARGV.

I can get the full list of recordings like this (or similar):


And then prune the list as each recording is used by the spec suite,
afterwards having a list of the recordings that should be deleted.

I need a hook that will run after the complete spec suite is run, before
exiting the process, while still in the context of the thread, and the
variable containing my list of files to delete is still accessible.

Failing that I can write the list to a file, and hook in the deletion in
rake spec task. The downside of this is I currently run the test suite
bundle exec rspec spec, and don’t really use the rake spec task.

Aside: It would involve some (lots?) of work to get rake spec working
this project. Currently when I run rake spec there is no output at
It appears to load the rails env, and do nothing. Any one have an idea
about that?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs