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