brew/Library/Homebrew/test/test_formula_lock.rb
Mike McQuaid 72d10fff0b Use constants for LinkedKegs/PinnedKegs/Locks.
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.
2016-09-15 18:28:42 +01:00

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