Merge pull request #19921 from Homebrew/cask_args-combine
bundle/dsl: combine cask_args calls
This commit is contained in:
commit
bfce68a6be
@ -41,7 +41,7 @@ module Homebrew
|
||||
case v
|
||||
when TrueClass
|
||||
"--#{k}"
|
||||
when FalseClass
|
||||
when FalseClass, NilClass
|
||||
nil
|
||||
else
|
||||
"--#{k}=#{v}"
|
||||
|
||||
@ -42,7 +42,7 @@ module Homebrew
|
||||
def cask_args(args)
|
||||
raise "cask_args(#{args.inspect}) should be a Hash object" unless args.is_a? Hash
|
||||
|
||||
@cask_arguments = args
|
||||
@cask_arguments.merge!(args)
|
||||
end
|
||||
|
||||
def brew(name, options = {})
|
||||
|
||||
@ -60,6 +60,20 @@ RSpec.describe Homebrew::Bundle::Dsl do
|
||||
end
|
||||
end
|
||||
|
||||
context "with multiple cask_args" do
|
||||
subject(:dsl) do
|
||||
dsl_from_string <<~EOS
|
||||
cask_args appdir: '/global-apps'
|
||||
cask_args require_sha: true
|
||||
cask_args appdir: '~/my-apps'
|
||||
EOS
|
||||
end
|
||||
|
||||
it "merges the arguments" do
|
||||
expect(dsl.cask_arguments).to eql(appdir: "~/my-apps", require_sha: true)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid input" do
|
||||
it "handles completely invalid code" do
|
||||
expect { dsl_from_string "abcdef" }.to raise_error(RuntimeError)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user