1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Move view context clear to before_setup (minitest) (#839)

We are using Draper with Minitest and experiencing the "leakage" of mailer view contexts into decorator tests. See #814 and related.

Draper does attempt to prevent the leakage by clearing the view context in a `teardown` hook, but this isn't effective. We are still seeing the problem.

This PR moves the clearing from `teardown` to `before_setup`, which properly resolves the leakage.
This commit is contained in:
Bob Showalter 2019-01-07 09:27:05 -05:00 committed by Cliff Braton
parent 4ddd3a0187
commit 7e3ace0242

View file

@ -3,9 +3,9 @@ module Draper
class TestCase < ::ActiveSupport::TestCase
module ViewContextTeardown
def teardown
super
def before_setup
Draper::ViewContext.clear!
super
end
end