aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_link.rb
blob: 3f050707243ce034b2d05f927296c59a4b105fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require "helper/integration_command_test_case"

class IntegrationCommandTestLink < IntegrationCommandTestCase
  def test_link
    assert_match "This command requires a keg argument", cmd_fail("link")

    setup_test_formula "testball1"
    cmd("install", "testball1")
    cmd("link", "testball1")

    cmd("unlink", "testball1")
    assert_match "Would link", cmd("link", "--dry-run", "testball1")
    assert_match "Would remove",
      cmd("link", "--dry-run", "--overwrite", "testball1")
    assert_match "Linking", cmd("link", "testball1")

    setup_test_formula "testball2", <<-EOS.undent
      keg_only "just because"
    EOS
    cmd("install", "testball2")
    assert_match "testball2 is keg-only", cmd("link", "testball2")
  end
end