brew/Library/Homebrew/test/support/helper/lifecycle_enforcer.rb
Alyssa Ross 70a381a00f tests: enforce super in lifecycle hooks
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.
2017-01-21 11:34:52 +00:00

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