aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2013-12-21 23:28:03 -0600
committerJack Nagel2013-12-21 23:28:03 -0600
commit554490f9e056073adb10683ef34cedb486dfabb6 (patch)
tree80e01a3f36c56fec874e49cccc4151c3672c6cb2 /Library/Homebrew/test
parente480206464c7a9d1a7c6378a1afcf4981b5d3b47 (diff)
downloadbrew-554490f9e056073adb10683ef34cedb486dfabb6.tar.bz2
cleaner: slightly less coupling in tests
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_cleaner.rb38
1 files changed, 18 insertions, 20 deletions
diff --git a/Library/Homebrew/test/test_cleaner.rb b/Library/Homebrew/test/test_cleaner.rb
index 9e902328a..a4989d920 100644
--- a/Library/Homebrew/test/test_cleaner.rb
+++ b/Library/Homebrew/test/test_cleaner.rb
@@ -2,31 +2,29 @@ require 'testing_env'
require 'cleaner'
require 'formula'
-class CleanerTestBall < Formula
- url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
+class CleanerTests < Test::Unit::TestCase
+ include FileUtils
- def install
- TEST_FOLDER.cd do
- bin.mkpath
- lib.mkpath
- cp 'mach/a.out', bin
- cp 'mach/fat.dylib', lib
- cp 'mach/x86_64.dylib', lib
- cp 'mach/i386.dylib', lib
- end
+ def setup
+ @f = formula("cleaner_test") { url 'foo-1.0' }
+ @f.prefix.mkpath
+ end
+
+ def teardown
+ @f.prefix.rmtree
end
-end
-class CleanerTests < Test::Unit::TestCase
def test_clean_file
- f = CleanerTestBall.new
- shutup { f.brew { f.install } }
+ @f.bin.mkpath
+ @f.lib.mkpath
+ cp "#{TEST_FOLDER}/mach/a.out", @f.bin
+ cp Dir["#{TEST_FOLDER}/mach/*.dylib"], @f.lib
- Cleaner.new f
+ Cleaner.new @f
- assert_equal 0100555, (f.bin/'a.out').stat.mode
- assert_equal 0100444, (f.lib/'fat.dylib').stat.mode
- assert_equal 0100444, (f.lib/'x86_64.dylib').stat.mode
- assert_equal 0100444, (f.lib/'i386.dylib').stat.mode
+ assert_equal 0100555, (@f.bin/'a.out').stat.mode
+ assert_equal 0100444, (@f.lib/'fat.dylib').stat.mode
+ assert_equal 0100444, (@f.lib/'x86_64.dylib').stat.mode
+ assert_equal 0100444, (@f.lib/'i386.dylib').stat.mode
end
end