diff --git a/lib/capistrano/configuration/actions/invocation.rb b/lib/capistrano/configuration/actions/invocation.rb index a30969b3..58245d62 100644 --- a/lib/capistrano/configuration/actions/invocation.rb +++ b/lib/capistrano/configuration/actions/invocation.rb @@ -121,7 +121,7 @@ module Capistrano options[:env] = env unless env.empty? shell = options[:shell] || self[:default_shell] - options[:shell] = shell if shell + options[:shell] = shell unless shell.nil? options end @@ -144,4 +144,4 @@ module Capistrano end end end -end \ No newline at end of file +end diff --git a/test/configuration/actions/invocation_test.rb b/test/configuration/actions/invocation_test.rb index 6680da55..47e84272 100644 --- a/test/configuration/actions/invocation_test.rb +++ b/test/configuration/actions/invocation_test.rb @@ -76,6 +76,11 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase assert_equal({:foo => "bar", :shell => "/bin/bash"}, @config.add_default_command_options(:foo => "bar")) end + def test_add_default_command_options_should_use_default_shell_of_false_if_present + @config.set :default_shell, false + assert_equal({:foo => "bar", :shell => false}, @config.add_default_command_options(:foo => "bar")) + end + def test_add_default_command_options_should_use_shell_in_preference_of_default_shell @config.set :default_shell, "/bin/bash" assert_equal({:foo => "bar", :shell => "/bin/sh"}, @config.add_default_command_options(:foo => "bar", :shell => "/bin/sh")) @@ -200,4 +205,4 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase c = mock("data", :called => true) Capistrano::Command.expects(:process).with(command, sessions, options).yields(a, b, c) end -end \ No newline at end of file +end