2017-02-23 06:03:33 +01:00
|
|
|
describe "brew link", :integration_test do
|
|
|
|
it "does not fail if the given Formula is already linked" do
|
|
|
|
setup_test_formula "testball1"
|
|
|
|
|
2017-07-29 19:55:05 +02:00
|
|
|
expect { brew "install", "testball1" }.to be_a_success
|
|
|
|
expect { brew "link", "testball1" }.to be_a_success
|
2017-02-23 06:03:33 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "links a given Formula" do
|
|
|
|
setup_test_formula "testball1"
|
|
|
|
|
2017-07-29 19:55:05 +02:00
|
|
|
expect { brew "install", "testball1" }.to be_a_success
|
|
|
|
expect { brew "unlink", "testball1" }.to be_a_success
|
2017-02-23 06:03:33 +01:00
|
|
|
|
|
|
|
expect { brew "link", "--dry-run", "testball1" }
|
|
|
|
.to output(/Would link/).to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
|
|
|
|
expect { brew "link", "--dry-run", "--overwrite", "testball1" }
|
|
|
|
.to output(/Would remove/).to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
|
|
|
|
expect { brew "link", "testball1" }
|
|
|
|
.to output(/Linking/).to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
end
|
|
|
|
|
|
|
|
it "refuses to link keg-only Formulae" do
|
2017-10-15 02:28:32 +02:00
|
|
|
setup_test_formula "testball1", <<~EOS
|
2017-02-23 06:03:33 +01:00
|
|
|
keg_only "just because"
|
|
|
|
EOS
|
|
|
|
|
2017-07-29 19:55:05 +02:00
|
|
|
expect { brew "install", "testball1" }.to be_a_success
|
2017-02-23 06:03:33 +01:00
|
|
|
|
2017-04-01 19:00:24 -07:00
|
|
|
expect { brew "link", "testball1", "SHELL" => "/bin/zsh" }
|
2017-02-23 06:03:33 +01:00
|
|
|
.to output(/testball1 is keg-only/).to_stderr
|
2017-04-01 19:00:24 -07:00
|
|
|
.and output(a_string_matching(/Note that doing so can interfere with building software\./)
|
|
|
|
.and(matching("If you need to have this software first in your PATH instead consider running:")
|
|
|
|
.and(including("echo 'export PATH=\"#{HOMEBREW_PREFIX}/opt/testball1/bin:$PATH\"' >> ~/.zshrc")))).to_stdout
|
2017-02-23 06:03:33 +01:00
|
|
|
.and be_a_success
|
|
|
|
end
|
|
|
|
end
|