Catch Time.zone before TestHelper resets it to UTC
This is most easiest done by switching to before_setup, which fits since we're also testing the ordering of the reset calls provided by the TestHelper.
This commit is contained in:
parent
a9c27de2c2
commit
3b953da779
@ -47,8 +47,17 @@ class Session < ActiveSupport::CurrentAttributes
|
|||||||
# Eagerly set-up `instance`s by reference.
|
# Eagerly set-up `instance`s by reference.
|
||||||
[ Current.instance, Session.instance ]
|
[ Current.instance, Session.instance ]
|
||||||
|
|
||||||
setup { @original_time_zone = Time.zone }
|
# Use library specific minitest hook to catch Time.zone before reset is called via TestHelper
|
||||||
teardown { Time.zone = @original_time_zone }
|
def before_setup
|
||||||
|
@original_time_zone = Time.zone
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
# Use library specific minitest hook to set Time.zone after reset is called via TestHelper
|
||||||
|
def after_teardown
|
||||||
|
super
|
||||||
|
Time.zone = @original_time_zone
|
||||||
|
end
|
||||||
|
|
||||||
setup { assert_nil Session.previous, "Expected Session to not have leaked state" }
|
setup { assert_nil Session.previous, "Expected Session to not have leaked state" }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user