summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/command.rb2
-rw-r--r--test/rubygems/test_gem_command.rb21
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 9b7b41d3a7..2fb3dab2fe 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -77,7 +77,7 @@ class Gem::Command
when Array
@extra_args = value
when String
- @extra_args = value.split
+ @extra_args = value.split(' ')
end
end
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index c3f057f2ff..44ec324ab9 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -57,6 +57,27 @@ class TestGemCommand < Gem::TestCase
assert_equal [], h
end
+ def test_self_extra_args
+ verbose, $VERBOSE, separator = $VERBOSE, nil, $;
+ extra_args = Gem::Command.extra_args
+
+ Gem::Command.extra_args = %w[--all]
+ assert_equal %w[--all], Gem::Command.extra_args
+
+ Gem::Command.extra_args = "--file --help"
+ assert_equal %w[--file --help], Gem::Command.extra_args
+
+ $; = "="
+
+ Gem::Command.extra_args = "--awesome=true --verbose"
+ assert_equal %w[--awesome=true --verbose], Gem::Command.extra_args
+
+ ensure
+ Gem::Command.extra_args = extra_args
+ $; = separator
+ $VERBOSE = verbose
+ end
+
def test_basic_accessors
assert_equal "doit", @cmd.command
assert_equal "gem doit", @cmd.program_name