test/cli/parser: add one more test
This commit is contained in:
parent
33a2f410af
commit
625a6c08eb
@ -10,6 +10,7 @@ RSpec.describe Homebrew::CLI::Parser do
|
|||||||
described_class.new(Cmd) do
|
described_class.new(Cmd) do
|
||||||
switch "--more-verbose", description: "Flag for higher verbosity"
|
switch "--more-verbose", description: "Flag for higher verbosity"
|
||||||
switch "--pry", env: :pry
|
switch "--pry", env: :pry
|
||||||
|
switch "--foo", env: :foo
|
||||||
switch "--bar", env: :bar
|
switch "--bar", env: :bar
|
||||||
switch "--hidden", hidden: true
|
switch "--hidden", hidden: true
|
||||||
end
|
end
|
||||||
@ -18,6 +19,7 @@ RSpec.describe Homebrew::CLI::Parser do
|
|||||||
before do
|
before do
|
||||||
allow(Homebrew::EnvConfig).to receive(:pry?).and_return(true)
|
allow(Homebrew::EnvConfig).to receive(:pry?).and_return(true)
|
||||||
allow(ENV).to receive(:fetch).and_call_original
|
allow(ENV).to receive(:fetch).and_call_original
|
||||||
|
allow(ENV).to receive(:fetch).with("HOMEBREW_FOO", nil).and_return("")
|
||||||
allow(ENV).to receive(:fetch).with("HOMEBREW_BAR", nil).and_return("1")
|
allow(ENV).to receive(:fetch).with("HOMEBREW_BAR", nil).and_return("1")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -116,6 +118,7 @@ RSpec.describe Homebrew::CLI::Parser do
|
|||||||
it "maps environment var to an option" do
|
it "maps environment var to an option" do
|
||||||
args = parser.parse([])
|
args = parser.parse([])
|
||||||
expect(args.pry?).to be true
|
expect(args.pry?).to be true
|
||||||
|
expect(args.foo?).to be false
|
||||||
expect(args.bar?).to be true
|
expect(args.bar?).to be true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user