From 92225e9ecc4dd7a8ca9c7acce0a2fcd678667ec6 Mon Sep 17 00:00:00 2001 From: Michael Harp Date: Tue, 4 Aug 2026 07:00:24 -0400 Subject: [PATCH] Document cleaning up fixtures after a successful beaker run fixtures:prep has a matching fixtures:clean task, but nothing invokes it automatically. Show enhancing the beaker task with a post-action, noting cleanup is skipped on failure so fixtures stay in place for debugging. Verified locally: RSpec::Core::RakeTask signals failure via exit rather than a raised exception, which skips the enhance block and leaves fixtures in place, matching puppetlabs_spec_helper's spec_clean "if successful" behavior. Follow-up to #433 per a Vox Pupuli Slack question from Hugo Haakseth. Signed-off-by: Michael Harp Co-authored-by: Claude Sonnet 5 --- docs/_ecosystem_8x/devkit/acceptance_testing.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/_ecosystem_8x/devkit/acceptance_testing.md b/docs/_ecosystem_8x/devkit/acceptance_testing.md index 3d7c374da..c11c6722b 100644 --- a/docs/_ecosystem_8x/devkit/acceptance_testing.md +++ b/docs/_ecosystem_8x/devkit/acceptance_testing.md @@ -116,6 +116,17 @@ Make `fixtures:prep` a prerequisite in your `Rakefile` so both local runs and CI task beaker: 'fixtures:prep' ``` +`fixtures:prep` has a matching `fixtures:clean` task, but nothing runs it for you. +To clean up automatically after a successful run, enhance the `beaker` task with a post-action: + +```ruby +Rake::Task[:beaker].enhance do + Rake::Task['fixtures:clean'].invoke +end +``` + +If the acceptance tests fail, the exception aborts the task before this runs, so the fixtures are left in place for you to inspect. + See the [`voxpupuli-acceptance` README](https://github.com/voxpupuli/voxpupuli-acceptance#fixtures) for more on the fixtures installation path. ## Anatomy of an acceptance test