aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_formula_lock.rb
blob: 1cc76d0a18862dabc062d12efbbe7fa373610b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'testing_env'
require 'formula_lock'

class FormulaLockTests < Homebrew::TestCase
  def setup
    @lock = FormulaLock.new("foo")
    @lock.lock
  end

  def teardown
    @lock.unlock
    FormulaLock::LOCKDIR.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