Permalink
Browse files

Merge pull request #29 from elliterate/fix_capistrano_defaults

Only set explicitly defined Capistrano variables.
  • Loading branch information...
2 parents d3495fa + ee0d174 commit bc68be3d3da2600ba5cc374771928480ded61978 @zilkey committed Aug 29, 2012
Showing with 8 additions and 4 deletions.
  1. +2 −2 lib/auto_tagger/capistrano_helper.rb
  2. +6 −2 spec/auto_tagger/capistrano_helper_spec.rb
@@ -41,14 +41,14 @@ def auto_tagger_options
if ! variables[:auto_tagger_dry_run].nil?
options[:dry_run] = variables[:auto_tagger_dry_run]
else
- options[:dry_run] = variables[:dry_run]
+ options[:dry_run] = variables[:dry_run] if variables.has_key?(:dry_run)
end
[
:date_separator, :push_refs, :fetch_refs, :remote, :ref_path, :offline,
:verbose, :refs_to_keep, :executable, :opts_file
].each do |key|
- options[key] = variables[:"auto_tagger_#{key}"]
+ options[key] = variables[:"auto_tagger_#{key}"] if variables.has_key?(:"auto_tagger_#{key}")
end
options
@@ -82,8 +82,12 @@
:executable,
:opts_file
].each do |key|
- it "includes :#{key}" do
- helper = AutoTagger::CapistranoHelper.new :"auto_tagger_#{key}" => "value"
+ it "includes :#{key} when specified" do
+ helper = AutoTagger::CapistranoHelper.new({})
+ helper.auto_tagger_options.should_not have_key(key)
+
+ helper = AutoTagger::CapistranoHelper.new(:"auto_tagger_#{key}" => "value")
+ helper.auto_tagger_options.should have_key(key)
helper.auto_tagger_options[key].should == "value"
end
end

0 comments on commit bc68be3

Please sign in to comment.