Skip to content

Commit

Permalink
Merge pull request #2678 from reitermarkus/fix-cli-default-options
Browse files Browse the repository at this point in the history
Fix cli default options.
  • Loading branch information
reitermarkus authored May 24, 2017
2 parents c6c8725 + b91d025 commit a3e30a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Library/Homebrew/cask/lib/hbc/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def option(name, method, default_value = nil)

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
Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/test/cask/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
])
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") }

Expand Down

0 comments on commit a3e30a1

Please sign in to comment.