diff options
| author | Jack Nagel | 2014-06-11 12:21:03 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-18 20:34:09 -0500 |
| commit | 58a75b0f71924a73085c61cd3dc48abe04aa50c1 (patch) | |
| tree | eaf6e25a42753192a459831dbb2acf18c51e6c50 /Library/Homebrew/test/test_pathname.rb | |
| parent | 06305e621199409f954b34166194e18e610d4e89 (diff) | |
| download | brew-58a75b0f71924a73085c61cd3dc48abe04aa50c1.tar.bz2 | |
Use assert_predicate
Diffstat (limited to 'Library/Homebrew/test/test_pathname.rb')
| -rw-r--r-- | Library/Homebrew/test/test_pathname.rb | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb index db256c79d..adf4b2238 100644 --- a/Library/Homebrew/test/test_pathname.rb +++ b/Library/Homebrew/test/test_pathname.rb @@ -22,18 +22,18 @@ class PathnameExtensionTests < Homebrew::TestCase touch @dir+'foo' assert !@dir.rmdir_if_possible - assert @dir.directory? + assert_predicate @dir, :directory? rm_f @dir+'foo' assert @dir.rmdir_if_possible - assert !@dir.exist? + refute_predicate @dir, :exist? end def test_rmdir_if_possible_ignore_DS_Store mkdir_p @dir touch @dir+'.DS_Store' assert @dir.rmdir_if_possible - assert !@dir.exist? + refute_predicate @dir, :exist? end def test_write @@ -68,8 +68,8 @@ class PathnameExtensionTests < Homebrew::TestCase def test_ensure_writable touch @file chmod 0555, @file - @file.ensure_writable { assert @file.writable? } - assert !@file.writable? + @file.ensure_writable { assert_predicate @file, :writable? } + refute_predicate @file, :writable? end def test_extname @@ -92,8 +92,8 @@ class PathnameExtensionTests < Homebrew::TestCase touch @file @dst.install(@file) - assert (@dst/@file.basename).exist? - assert !@file.exist? + assert_predicate @dst/@file.basename, :exist? + refute_predicate @file, :exist? end def setup_install_test @@ -108,8 +108,8 @@ class PathnameExtensionTests < Homebrew::TestCase setup_install_test do @dst.install 'a.txt' - assert((@dst+'a.txt').exist?, 'a.txt not installed.') - assert(!(@dst+'b.txt').exist?, 'b.txt was installed.') + assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed" + refute_predicate @dst+"b.txt", :exist?, "b.txt was installed." end end @@ -117,8 +117,8 @@ class PathnameExtensionTests < Homebrew::TestCase setup_install_test do @dst.install %w[a.txt b.txt] - assert((@dst+'a.txt').exist?, 'a.txt not installed.') - assert((@dst+'b.txt').exist?, 'b.txt not installed.') + assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed" + assert_predicate @dst+"b.txt", :exist?, "b.txt was not installed" end end @@ -126,8 +126,8 @@ class PathnameExtensionTests < Homebrew::TestCase setup_install_test do @dst.install Dir['*.txt'] - assert((@dst+'a.txt').exist?, 'a.txt not installed.') - assert((@dst+'b.txt').exist?, 'b.txt not installed.') + assert_predicate @dst+"a.txt", :exist?, "a.txt was not installed" + assert_predicate @dst+"b.txt", :exist?, "b.txt was not installed" end end @@ -138,8 +138,8 @@ class PathnameExtensionTests < Homebrew::TestCase @dst.install 'bin' - assert((@dst+'bin/a.txt').exist?, 'a.txt not installed.') - assert((@dst+'bin/b.txt').exist?, 'b.txt not installed.') + assert_predicate @dst+"bin/a.txt", :exist?, "a.txt was not installed" + assert_predicate @dst+"bin/b.txt", :exist?, "b.txt was not installed" end end @@ -147,9 +147,9 @@ class PathnameExtensionTests < Homebrew::TestCase setup_install_test do @dst.install 'a.txt' => 'c.txt' - assert((@dst+'c.txt').exist?, 'c.txt not installed.') - assert(!(@dst+'a.txt').exist?, 'a.txt was installed but not renamed.') - assert(!(@dst+'b.txt').exist?, 'b.txt was installed.') + assert_predicate @dst+"c.txt", :exist?, "c.txt was not installed" + refute_predicate @dst+"a.txt", :exist?, "a.txt was installed but not renamed" + refute_predicate @dst+"b.txt", :exist?, "b.txt was installed" end end @@ -157,10 +157,10 @@ class PathnameExtensionTests < Homebrew::TestCase setup_install_test do @dst.install({'a.txt' => 'c.txt', 'b.txt' => 'd.txt'}) - assert((@dst+'c.txt').exist?, 'c.txt not installed.') - assert((@dst+'d.txt').exist?, 'd.txt not installed.') - assert(!(@dst+'a.txt').exist?, 'a.txt was installed but not renamed.') - assert(!(@dst+'b.txt').exist?, 'b.txt was installed but not renamed.') + assert_predicate @dst+"c.txt", :exist?, "c.txt was not installed" + assert_predicate @dst+"d.txt", :exist?, "d.txt was not installed" + refute_predicate @dst+"a.txt", :exist?, "a.txt was installed but not renamed" + refute_predicate @dst+"b.txt", :exist?, "b.txt was installed but not renamed" end end @@ -171,9 +171,9 @@ class PathnameExtensionTests < Homebrew::TestCase @dst.install 'bin' => 'libexec' - assert(!(@dst+'bin').exist?, 'bin was installed but not renamed.') - assert((@dst+'libexec/a.txt').exist?, 'a.txt not installed.') - assert((@dst+'libexec/b.txt').exist?, 'b.txt not installed.') + refute_predicate @dst+"bin", :exist?, "bin was installed but not renamed" + assert_predicate @dst+"libexec/a.txt", :exist?, "a.txt was not installed" + assert_predicate @dst+"libexec/b.txt", :exist?, "b.txt was not installed" end end @@ -184,19 +184,19 @@ class PathnameExtensionTests < Homebrew::TestCase @dst.install_symlink @src+'bin' - assert((@dst+'bin').symlink?) - assert((@dst+'bin').directory?) - assert((@dst+'bin/a.txt').exist?) - assert((@dst+'bin/b.txt').exist?) + assert_predicate @dst+"bin", :symlink? + assert_predicate @dst+"bin", :directory? + assert_predicate @dst+"bin/a.txt", :exist? + assert_predicate @dst+"bin/b.txt", :exist? - assert((@dst+'bin').readlink.relative?) + assert_predicate (@dst+"bin").readlink, :relative? end end def test_install_creates_intermediate_directories touch @file - assert !@dir.directory? + refute_predicate @dir, :directory? @dir.install(@file) - assert @dir.directory? + assert_predicate @dir, :directory? end end |
