diff options
| author | Markus Reiter | 2017-02-23 06:03:33 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-23 21:22:47 +0100 |
| commit | ada6a1b09e04ed3ab6758adfb231bc31b332442c (patch) | |
| tree | 1eb4226b05a77f95537e8ea24ee422150c6005e7 /Library/Homebrew/test/cmd | |
| parent | c7121f6be50e44784e3e29114617c29715bd9c0f (diff) | |
| download | brew-ada6a1b09e04ed3ab6758adfb231bc31b332442c.tar.bz2 | |
Convert `brew link` test to spec.
Diffstat (limited to 'Library/Homebrew/test/cmd')
| -rw-r--r-- | Library/Homebrew/test/cmd/link_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cmd/link_spec.rb b/Library/Homebrew/test/cmd/link_spec.rb new file mode 100644 index 000000000..7b85c96dc --- /dev/null +++ b/Library/Homebrew/test/cmd/link_spec.rb @@ -0,0 +1,56 @@ +describe "brew link", :integration_test do + it "fails when no argument is given" do + expect { brew "link" } + .to output(/This command requires a keg argument/).to_stderr + .and not_to_output.to_stdout + .and be_a_failure + end + + it "does not fail if the given Formula is already linked" do + setup_test_formula "testball1" + + shutup do + expect { brew "install", "testball1" }.to be_a_success + expect { brew "link", "testball1" }.to be_a_success + end + end + + it "links a given Formula" do + setup_test_formula "testball1" + + shutup do + expect { brew "install", "testball1" }.to be_a_success + expect { brew "unlink", "testball1" }.to be_a_success + end + + 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 + setup_test_formula "testball1", <<-EOS.undent + keg_only "just because" + EOS + + shutup do + expect { brew "install", "testball1" }.to be_a_success + end + + expect { brew "link", "testball1" } + .to output(/testball1 is keg-only/).to_stderr + .and output(/Note that doing so can interfere with building software\./).to_stdout + .and be_a_success + end +end |
