test/cmd: test Bash logic.
This commit is contained in:
parent
dc1fdc9f8d
commit
e9419dbce7
@ -1,23 +1,19 @@
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "brew --caskroom", :integration_test do
|
||||
let(:local_transmission) {
|
||||
Cask::CaskLoader.load(cask_path("local-transmission"))
|
||||
}
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
let(:local_caffeine) {
|
||||
Cask::CaskLoader.load(cask_path("local-caffeine"))
|
||||
}
|
||||
describe "brew --caskroom" do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "outputs Homebrew's caskroom" do
|
||||
expect { brew "--caskroom" }
|
||||
.to output("#{HOMEBREW_PREFIX/"Caskroom"}\n").to_stdout
|
||||
it "prints Homebrew's Caskroom", :integration_test do
|
||||
expect { brew_sh "--caskroom" }
|
||||
.to output("#{ENV["HOMEBREW_PREFIX"]}/Caskroom\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
it "outputs the caskroom path of casks" do
|
||||
it "prints the Caskroom for Casks", :integration_test do
|
||||
expect { brew "--caskroom", cask_path("local-transmission"), cask_path("local-caffeine") }
|
||||
.to output("#{HOMEBREW_PREFIX/"Caskroom"/"local-transmission"}\n" \
|
||||
"#{HOMEBREW_PREFIX/"Caskroom"/"local-caffeine\n"}").to_stdout
|
||||
|
||||
@ -6,7 +6,14 @@ require "cmd/shared_examples/args_parse"
|
||||
describe "brew --cellar" do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "returns the Cellar subdirectory for a given Formula", :integration_test do
|
||||
it "prints Homebrew's Cellar", :integration_test do
|
||||
expect { brew_sh "--cellar" }
|
||||
.to output("#{ENV["HOMEBREW_CELLAR"]}\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
it "prints the Cellar for a Formula", :integration_test do
|
||||
expect { brew "--cellar", testball }
|
||||
.to output(%r{#{HOMEBREW_CELLAR}/testball}o).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
|
||||
@ -6,9 +6,16 @@ require "cmd/shared_examples/args_parse"
|
||||
describe "brew --prefix" do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "prints a given Formula's prefix", :integration_test do
|
||||
expect { brew "--prefix", testball }
|
||||
.to output("#{HOMEBREW_PREFIX}/opt/testball\n").to_stdout
|
||||
it "prints Homebrew's prefix", :integration_test do
|
||||
expect { brew_sh "--prefix" }
|
||||
.to output("#{ENV["HOMEBREW_PREFIX"]}\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
it "prints the prefix for a Formula", :integration_test do
|
||||
expect { brew_sh "--prefix", "wget" }
|
||||
.to output("#{ENV["HOMEBREW_PREFIX"]}/opt/wget\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
@ -6,7 +6,14 @@ require "cmd/shared_examples/args_parse"
|
||||
describe "brew --repository" do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "prints the path of a given Tap", :integration_test do
|
||||
it "prints Homebrew's repository", :integration_test do
|
||||
expect { brew_sh "--repository" }
|
||||
.to output("#{ENV["HOMEBREW_REPOSITORY"]}\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
|
||||
it "prints a Tap's repository", :integration_test do
|
||||
expect { brew "--repository", "foo/bar" }
|
||||
.to output("#{HOMEBREW_LIBRARY}/Taps/foo/homebrew-bar\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user