Merge pull request #2678 from reitermarkus/fix-cli-default-options
Fix cli default options.
This commit is contained in:
commit
a3e30a11d1
@ -24,10 +24,12 @@ module Hbc
|
|||||||
|
|
||||||
if [true, false].include?(default_value)
|
if [true, false].include?(default_value)
|
||||||
define_method(:"#{method}?") do
|
define_method(:"#{method}?") do
|
||||||
|
return default_value unless instance_variable_defined?(:"@#{method}")
|
||||||
instance_variable_get(:"@#{method}") == true
|
instance_variable_get(:"@#{method}") == true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
define_method(:"#{method}") do
|
define_method(:"#{method}") do
|
||||||
|
return default_value unless instance_variable_defined?(:"@#{method}")
|
||||||
instance_variable_get(:"@#{method}")
|
instance_variable_get(:"@#{method}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,6 +13,13 @@ describe Hbc::CLI, :cask do
|
|||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when no option is specified" do
|
||||||
|
it "--binaries is true by default" do
|
||||||
|
command = Hbc::CLI::Install.new("some-cask")
|
||||||
|
expect(command.binaries?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "::run" do
|
context "::run" do
|
||||||
let(:noop_command) { double("CLI::Noop") }
|
let(:noop_command) { double("CLI::Noop") }
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user