In .fixtures.yml, there are modules downloaded from a public library, such as stdlib and concat in the following example:
fixtures:
forge_modules:
stdlib: puppetlabs/stdlib
concat: puppetlabs/concat
These modules need to be downloaded whenever running an rspec-puppet test. They also get deleted after tests are done.
It is good if all tests run completely. But if there is a failed test that needs to run separately, these modules are not available. I have to run all tests (100+) together, thus public modules can be downloaded and available. It is very annoying when I am debugging a small error.
Is there way to configure rspec-puppet so that it doesn't download/delete those public modules every time?
Until recently, the Puppetlabs_spec_helper actually behaved the way you wanted it to, i.e. the fixtures directory was not cleaned unless all the tests pass.
I notice this patch here changed that behaviour. For what it's worth, I also don't agree with that change.
Anyway, if you want the old behaviour, you could:
Use an earlier version of Puppetlabs_spec_helper.
Define a custom spec task.
Or just run
bundle exec rake spec_prep spec_standalone.Or if you just want to run the tests in one file, run
bundle exec rake spec_prep; bundle exec rspec spec/somefile_spec.rb --fail-fast. (The--fail-fastoption is useful when debugging failing tests and it causes rspec to abort on the first failure.)To define a custom spec task with the old behaviour, add this to your Rakefile:
If, instead, you want it to never, ever clean the fixtures directory:
In either case, you would then run the tests using: