brew/Library/Homebrew/test/formula_lock_test.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

25 lines
495 B
Ruby

require "testing_env"
require "formula_lock"
class FormulaLockTests < Homebrew::TestCase
def setup
super
@lock = FormulaLock.new("foo")
@lock.lock
end
def teardown
@lock.unlock
HOMEBREW_LOCK_DIR.children.each(&:unlink)
super
end
def test_locking_file_with_existing_lock_raises_error
assert_raises(OperationInProgressError) { FormulaLock.new("foo").lock }
end
def test_locking_existing_lock_suceeds
assert_nothing_raised { @lock.lock }
end
end