I think I finally discovered why the directory /tmp
was being deleted, a behaviour that has been confusing us lately. (See https://github.com/thoughtbot/administrate/pull/1731, https://github.com/thoughtbot/administrate/pull/1726, https://github.com/thoughtbot/administrate/pull/1695).
The issue appears to be with the generator specs. These load this configuration when they run:
In this code, destination
and prepare_destination
are helpers provided by Rails to assist when testing generators. See https://api.rubyonrails.org/v3.2.2/classes/Rails/Generators/TestCase.html
Turns out that prepare_destination
prepares the destination by... rimraffing it. See: https://github.com/rails/rails/blob/557014d45aeed82ed1e79b83ab59697392a1a5de/railties/lib/rails/generators/test_case.rb#L235
So if we set /tmp
as destination, it will be destroyed ahead of each generator spec example.
To fix this, I'm telling it to use a specific subdirectory that can be deleted at will, avoiding further harm.