mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

These definitions are scattered throughout the codebase which makes it hard to refactor them later (my goal is to move them outside of HOMEBREW_LIBRARY). Unify their definitions for clearer code and easier movement later.
23 lines
475 B
Ruby
23 lines
475 B
Ruby
require "testing_env"
|
|
require "formula_lock"
|
|
|
|
class FormulaLockTests < Homebrew::TestCase
|
|
def setup
|
|
@lock = FormulaLock.new("foo")
|
|
@lock.lock
|
|
end
|
|
|
|
def teardown
|
|
@lock.unlock
|
|
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
|
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
|