diff options
| author | Jack Nagel | 2015-03-25 21:37:26 -0400 |
|---|---|---|
| committer | Jack Nagel | 2015-03-25 21:37:26 -0400 |
| commit | b49d3bd0a99d2ffb7d85e0fd3a13decf820ff85c (patch) | |
| tree | d15e23fba2c2c9acfae742b2644b2b373a51ca74 /Library/Homebrew/test/test_pathname.rb | |
| parent | 53b7d45de8f38d1998e5c23a77064ae3df4be522 (diff) | |
| download | brew-b49d3bd0a99d2ffb7d85e0fd3a13decf820ff85c.tar.bz2 | |
Pull install tests into a separate class
Diffstat (limited to 'Library/Homebrew/test/test_pathname.rb')
| -rw-r--r-- | Library/Homebrew/test/test_pathname.rb | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb index c59571305..23b2108a7 100644 --- a/Library/Homebrew/test/test_pathname.rb +++ b/Library/Homebrew/test/test_pathname.rb @@ -95,6 +95,27 @@ class PathnameExtensionTests < Homebrew::TestCase refute_predicate @file, :exist? end + def test_install_creates_intermediate_directories + touch @file + refute_predicate @dir, :directory? + @dir.install(@file) + assert_predicate @dir, :directory? + end + + def test_install_renamed + @dir.extend(InstallRenamed) + + @file.write "a" + @dir.install @file + @file.write "b" + @dir.install @file + + assert_equal "a", File.read(@dir+@file.basename) + assert_equal "b", File.read(@dir+"#{@file.basename}.default") + end +end + +class PathnameInstallTests < PathnameExtensionTests def setup_install_test (@src+'a.txt').write 'This is sample file a.' (@src+'b.txt').write 'This is sample file b.' @@ -186,23 +207,4 @@ class PathnameExtensionTests < Homebrew::TestCase assert_predicate @dst+"bin/b.txt", :exist? assert_predicate (@dst+"bin").readlink, :relative? end - - def test_install_creates_intermediate_directories - touch @file - refute_predicate @dir, :directory? - @dir.install(@file) - assert_predicate @dir, :directory? - end - - def test_install_renamed - @dir.extend(InstallRenamed) - - @file.write "a" - @dir.install @file - @file.write "b" - @dir.install @file - - assert_equal "a", File.read(@dir+@file.basename) - assert_equal "b", File.read(@dir+"#{@file.basename}.default") - end end |
