diff options
| author | mansimarkaur | 2017-06-20 05:32:13 +0530 |
|---|---|---|
| committer | mansimarkaur | 2017-07-25 20:58:20 +0530 |
| commit | 6de94839de75e269883efeb85fa7faa2e1e5c1ba (patch) | |
| tree | 5ad9d5a013b77ceafb5b7e21b64a70522ed681e3 | |
| parent | d5838c7e803056a525de8cd11b4c540c562a330e (diff) | |
| download | brew-6de94839de75e269883efeb85fa7faa2e1e5c1ba.tar.bz2 | |
Adding tests for caveats
| -rw-r--r-- | Library/Homebrew/test/caveats_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/Homebrew/test/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index d8be9dc52..176d8e6ca 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -26,4 +26,51 @@ describe Caveats do expect(described_class.new(f)).not_to be_empty end end + + describe "#caveats" do + context "when f.plist is not nil" do + it "prints plist startup information when f.plist_startup is not nil" do + f = formula do + url "foo-1.0" + def plist + "plist_test.plist" + end + plist_options startup: true + end + expect(described_class.new(f).caveats).to include("startup:\n sudo brew") + end + + it "prints plist login information when f.plist_startup is nil" do + f = formula do + url "foo-1.0" + def plist + "plist_test.plist" + end + end + expect(described_class.new(f).caveats).to include("login:\n brew") + end + end + + context "when f.keg_only is not nil" do + it "tells formula is keg_only and gives information about command to be run when f.bin and f.sbin are directories" do + Path = Pathname.new("path") + f = formula do + url "foo-1.0" + keg_only "some reason" + end + + allow(f).to receive(:bin).and_return(Path) + allow(f.bin).to receive(:directory?).and_return(true) + + allow(f).to receive(:sbin).and_return(Path) + allow(f.sbin).to receive(:directory?).and_return(true) + + caveats = described_class.new(f).caveats + + expect(caveats).to include("keg-only") + expect(caveats).to include(f.opt_bin.to_s) + expect(caveats).to include(f.opt_sbin.to_s) + end + end + end end |
