diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb index c595713052..23b2108a75 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