Peter Boling
2011-Mar-30 15:03 UTC
[rspec-users] 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 filenames, 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 for unused VCR recordings, and another to both check and delete unused recordings. I need a way to know if the full spec suite is being run. I think this can be determined with some fancy testing on ARGV. I can get the full list of recordings like this (or similar): FileList["spec/fixtures/vcr/**/*.yml"].reject{|file|File.directory? (file)} 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 the rake spec task. The downside of this is we currently run our test suite with `bundle exec rspec spec`, and don''t really use the rake spec task. It would involve other work to get rake spec working in this project.
Peter Boling
2011-Mar-30 15:59 UTC
[rspec-users] 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 filenames, 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 for unused VCR recordings, and another to both check and delete unused recordings. I need a way to know if the full spec suite is being run. I think this can be determined with some fancy testing on ARGV. I can get the full list of recordings like this (or similar): FileList["spec/fixtures/vcr/**/*.yml"].reject{|file|File.directory?(file)} 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 the rake spec task. The downside of this is I currently run the test suite with `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 in this project. Currently when I run `rake spec` there is no output at all. It appears to load the rails env, and do nothing. Any one have an idea about that? -- |7eter H. l3oling -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110330/7ce48cd2/attachment.html>
Scarmt Yelon
2011-Apr-05 06:45 UTC
[rspec-users] spec_helper aware of full test suite being run? After hook to run code after running all specs?
The other day my child wanted to make a project. As a Dad it was my duty to help him out in his project. But when he told me the topic, I was so moved by it, http://www.samrx.com/buy-kamagra-oral-jelly.aspx because your name popped in my mind immediately and within no time the project could be completed. Thank you for your stuff!!! You are good. -- Posted via http://www.ruby-forum.com/.