diff options
| author | Andrea Kao | 2016-07-20 15:38:39 -0700 |
|---|---|---|
| committer | Martin Afanasjew | 2016-08-08 22:44:36 +0200 |
| commit | c8b0a55c097f13556a27223b15196a3e23e36483 (patch) | |
| tree | 3269efb4699ba6833f196776fa66d152ff516499 /Library | |
| parent | c7ba1c65caafa7af48b834d34921ddfc95bed8b8 (diff) | |
| download | brew-c8b0a55c097f13556a27223b15196a3e23e36483.tar.bz2 | |
tests: refactor installation, renaming of CoreTap formula
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 298485b3c..393d1d19a 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -163,6 +163,31 @@ class IntegrationCommandTests < Homebrew::TestCase tap end + def install_and_rename_coretap_formula(old_name, new_name) + core_tap = CoreTap.new + core_tap.path.cd do + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has not yet been renamed" + end + end + + cmd("install", old_name) + (core_tap.path/"Formula/#{old_name}.rb").unlink + formula_renames = core_tap.path/"formula_renames.json" + formula_renames.write Utils::JSON.dump(old_name => new_name) + + core_tap.path.cd do + shutup do + system "git", "add", "--all" + system "git", "commit", "-m", + "#{old_name.capitalize} has been renamed to #{new_name.capitalize}" + end + end + end + def testball "#{File.expand_path("..", __FILE__)}/testball.rb" end @@ -777,31 +802,7 @@ class IntegrationCommandTests < Homebrew::TestCase assert_match "testball1 doesn't replace any formula", cmd_fail("migrate", "testball1") - core_tap = CoreTap.new - core_tap.path.cd do - shutup do - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", "Testball1 has not yet been renamed" - end - end - - cmd("install", "testball1") - (core_tap.path/"Formula/testball1.rb").unlink - formula_renames = core_tap.path/"formula_renames.json" - formula_renames.write <<-EOS.undent - { - "testball1": "testball2" - } - EOS - - core_tap.path.cd do - shutup do - system "git", "add", "--all" - system "git", "commit", "-m", "Testball1 has been renamed to Testball2" - end - end - + install_and_rename_coretap_formula "testball1", "testball2" assert_match "Migrating testball1 to testball2", cmd("migrate", "testball1") (HOMEBREW_CELLAR/"testball1").unlink assert_match "Error: No such keg", cmd_fail("migrate", "testball1") |
