Skip to content

Commit

Permalink
Use setup+teardown in AS::TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Jan 24, 2024
1 parent 234e126 commit 4df96c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/dotenv/autorestore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

if defined?(ActiveSupport)
ActiveSupport.on_load(:active_support_test_case) do
# Save ENV when the test suite loads
Dotenv.save

ActiveSupport::TestCase.class_eval do
# Save ENV before each test
setup { Dotenv.save }

# Restore ENV after each test
setup { Dotenv.restore }
teardown { Dotenv.restore }
end
end
end

0 comments on commit 4df96c1

Please sign in to comment.