test_keg: reduce noise by including FileUtils
This commit is contained in:
parent
cf2b0f88e6
commit
e0c4fd5b72
@ -4,6 +4,8 @@ require 'keg'
|
|||||||
require 'stringio'
|
require 'stringio'
|
||||||
|
|
||||||
class LinkTests < Test::Unit::TestCase
|
class LinkTests < Test::Unit::TestCase
|
||||||
|
include FileUtils
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@formula = TestBall.new
|
@formula = TestBall.new
|
||||||
shutup do
|
shutup do
|
||||||
@ -17,7 +19,7 @@ class LinkTests < Test::Unit::TestCase
|
|||||||
@old_stdout = $stdout
|
@old_stdout = $stdout
|
||||||
$stdout = StringIO.new
|
$stdout = StringIO.new
|
||||||
|
|
||||||
FileUtils.mkpath HOMEBREW_PREFIX/"bin"
|
mkpath HOMEBREW_PREFIX/"bin"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_linking_keg
|
def test_linking_keg
|
||||||
@ -49,28 +51,28 @@ class LinkTests < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_linking_fails_when_files_exist
|
def test_linking_fails_when_files_exist
|
||||||
FileUtils.touch HOMEBREW_PREFIX/"bin/helloworld"
|
touch HOMEBREW_PREFIX/"bin/helloworld"
|
||||||
assert_raise RuntimeError do
|
assert_raise RuntimeError do
|
||||||
shutup { @keg.link }
|
shutup { @keg.link }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_link_overwrite
|
def test_link_overwrite
|
||||||
FileUtils.touch HOMEBREW_PREFIX/"bin/helloworld"
|
touch HOMEBREW_PREFIX/"bin/helloworld"
|
||||||
@mode.overwrite = true
|
@mode.overwrite = true
|
||||||
assert_equal 3, @keg.link(@mode)
|
assert_equal 3, @keg.link(@mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_link_overwrite_broken_symlinks
|
def test_link_overwrite_broken_symlinks
|
||||||
FileUtils.cd HOMEBREW_PREFIX/"bin" do
|
cd HOMEBREW_PREFIX/"bin" do
|
||||||
FileUtils.ln_s "nowhere", "helloworld"
|
ln_s "nowhere", "helloworld"
|
||||||
end
|
end
|
||||||
@mode.overwrite = true
|
@mode.overwrite = true
|
||||||
assert_equal 3, @keg.link(@mode)
|
assert_equal 3, @keg.link(@mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_link_overwrite_dryrun
|
def test_link_overwrite_dryrun
|
||||||
FileUtils.touch HOMEBREW_PREFIX/"bin/helloworld"
|
touch HOMEBREW_PREFIX/"bin/helloworld"
|
||||||
@mode.overwrite = true
|
@mode.overwrite = true
|
||||||
@mode.dry_run = true
|
@mode.dry_run = true
|
||||||
|
|
||||||
@ -86,6 +88,6 @@ class LinkTests < Test::Unit::TestCase
|
|||||||
|
|
||||||
$stdout = @old_stdout
|
$stdout = @old_stdout
|
||||||
|
|
||||||
FileUtils.rmtree HOMEBREW_PREFIX/"bin"
|
rmtree HOMEBREW_PREFIX/"bin"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user