Cleanup files created with Rspec

So I guess I just never took the time to look but our main Ruby on Rails web application creates a lot of files during testing.  Now I am not talking about database anything here.  We create icons, and pdf's and rtf files during our Rspec test suite.

Just add this to you spec_helper.rb file:

[sourcecode language="ruby"]

config.after(:suite) do
FileUtils.rm_rf(Dir["#{Rails.root}/public/system"])
end
[/sourcecode]

Obviously change the directory to the correct one.

Hope that helps somebody :)

comments powered by Disqus