Skip to content

Commit

Permalink
🧹 Allow :clean or :clean_repo to work for the cleaners
Browse files Browse the repository at this point in the history
Hyrax has :clean_repo and Hyku has :clean

Sometimes folks copy over specs from Hyrax, and bring along the
:clean_repo; which looks like it should work.

With this commit, we bring that logic along!
  • Loading branch information
jeremyf committed Dec 21, 2023
1 parent 046c6ea commit 75fc391
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,14 @@
# make sure we are on the default fedora config
ActiveFedora::Fedora.reset!
ActiveFedora::SolrService.reset!
# Pass `:clean' to destroy objects in fedora/solr and start from scratch
ActiveFedora::Cleaner.clean! if example.metadata[:clean]
# Pass `:clean' (or hyrax's convention of :clean_repo) to destroy objects in fedora/solr and
# start from scratch
if example.metadata[:clean] || example.metadata[:clean_repo]
## We don't need to do `Hyrax::SolrService.wipe!` so long as we're using `ActiveFedora.clean!`;
## but Valkyrie is coming so be prepared.
# Hyrax::SolrService.wipe!
ActiveFedora::Cleaner.clean!
end
if example.metadata[:type] == :feature && Capybara.current_driver != :rack_test
DatabaseCleaner.strategy = :truncation
else
Expand Down

0 comments on commit 75fc391

Please sign in to comment.