Remove pin directory when empty
This commit is contained in:
parent
35b9a00706
commit
f222ca04fd
@ -23,6 +23,7 @@ class FormulaPin
|
|||||||
|
|
||||||
def unpin
|
def unpin
|
||||||
path.unlink if pinned?
|
path.unlink if pinned?
|
||||||
|
PINDIR.rmdir_if_possible
|
||||||
end
|
end
|
||||||
|
|
||||||
def pinned?
|
def pinned?
|
||||||
|
|||||||
@ -27,19 +27,17 @@ class FormulaPinTests < Homebrew::TestCase
|
|||||||
assert_predicate @pin, :pinnable?
|
assert_predicate @pin, :pinnable?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pin
|
|
||||||
(@f.rack+'0.1').mkpath
|
|
||||||
@pin.pin
|
|
||||||
assert_predicate @pin, :pinned?
|
|
||||||
assert_equal 1, FormulaPin::PINDIR.children.length
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_unpin
|
def test_unpin
|
||||||
(@f.rack+'0.1').mkpath
|
(@f.rack+'0.1').mkpath
|
||||||
@pin.pin
|
@pin.pin
|
||||||
|
|
||||||
|
assert_predicate @pin, :pinned?
|
||||||
|
assert_equal 1, FormulaPin::PINDIR.children.length
|
||||||
|
|
||||||
@pin.unpin
|
@pin.unpin
|
||||||
|
|
||||||
refute_predicate @pin, :pinned?
|
refute_predicate @pin, :pinned?
|
||||||
assert_equal 0, FormulaPin::PINDIR.children.length
|
refute_predicate FormulaPin::PINDIR, :directory?
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user