
This will allow us to have global setup and teardown for tests. For example, we can automatically clear caches after each test, to avoid annoying intermittent failures like #1879 and #1886.
23 lines
433 B
Ruby
23 lines
433 B
Ruby
module Test
|
|
module Helper
|
|
module LifecycleEnforcer
|
|
def setup
|
|
@__setup_called = true
|
|
super
|
|
end
|
|
|
|
def teardown
|
|
@__teardown_called = true
|
|
super
|
|
end
|
|
|
|
def after_teardown
|
|
assert @__setup_called, "Expected setup to call `super` but didn't"
|
|
assert @__teardown_called, "Expected teardown to call `super` but didn't"
|
|
|
|
super
|
|
end
|
|
end
|
|
end
|
|
end
|