aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-24 22:14:52 +0200
committerGitHub2017-05-24 22:14:52 +0200
commita3e30a11d147da760c14cbbe00e50be53a468534 (patch)
tree31eb6f74c6532eb466a9d68f97eb149224123980
parentc6c8725f1bbff903735bbcaaecdee5ac4b6f276b (diff)
parentb91d0254bbd07b7b0ddf3906cb6c08684ebc07ef (diff)
downloadbrew-a3e30a11d147da760c14cbbe00e50be53a468534.tar.bz2
Merge pull request #2678 from reitermarkus/fix-cli-default-options
Fix cli default options.
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/options.rb2
-rw-r--r--Library/Homebrew/test/cask/cli_spec.rb7
2 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/options.rb b/Library/Homebrew/cask/lib/hbc/cli/options.rb
index 84126caa5..75dd77212 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/options.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/options.rb
@@ -24,10 +24,12 @@ module Hbc
if [true, false].include?(default_value)
define_method(:"#{method}?") do
+ return default_value unless instance_variable_defined?(:"@#{method}")
instance_variable_get(:"@#{method}") == true
end
else
define_method(:"#{method}") do
+ return default_value unless instance_variable_defined?(:"@#{method}")
instance_variable_get(:"@#{method}")
end
end
diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb
index d5bfba754..baad160c3 100644
--- a/Library/Homebrew/test/cask/cli_spec.rb
+++ b/Library/Homebrew/test/cask/cli_spec.rb
@@ -13,6 +13,13 @@ describe Hbc::CLI, :cask do
])
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
let(:noop_command) { double("CLI::Noop") }