diff options
| author | Andrea Kao | 2016-07-20 15:47:45 -0700 | 
|---|---|---|
| committer | Mike McQuaid | 2016-08-04 11:44:39 +0100 | 
| commit | 38209aadbfe4fd0c6772467c4bc5c63325d53f6c (patch) | |
| tree | df887669e62ae59287a9fb9580b3650127ab7b85 | |
| parent | 4338f35b848ad61462fc4f73e1365e6c002201a2 (diff) | |
| download | brew-38209aadbfe4fd0c6772467c4bc5c63325d53f6c.tar.bz2 | |
tests: add cmd/migrate integration test
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 40 | 
1 files changed, 40 insertions, 0 deletions
| diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 5f3a1ddb1..d1bc98a54 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -32,6 +32,7 @@ class IntegrationCommandTests < Homebrew::TestCase        coretap.path/".git",        coretap.alias_dir,        coretap.formula_dir.children, +      coretap.path/"formula_renames.json",      ].flatten      FileUtils.rm_rf paths_to_delete    end @@ -761,6 +762,45 @@ class IntegrationCommandTests < Homebrew::TestCase      cmd("analytics", "regenerate-uuid")    end +  def test_migrate +    setup_test_formula "testball1" +    setup_test_formula "testball2" +    assert_match "Invalid usage", cmd_fail("migrate") +    assert_match "No available formula with the name \"testball\"", +      cmd_fail("migrate", "testball") +    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 + +    assert_match "Migrating testball1 to testball2", cmd("migrate", "testball1") +    (HOMEBREW_CELLAR/"testball1").unlink +    assert_match "Error: No such keg", cmd_fail("migrate", "testball1") +  end +    def test_switch      assert_match "Usage: brew switch <name> <version>", cmd_fail("switch")      assert_match "testball not found", cmd_fail("switch", "testball", "0.1") | 
