aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_update_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_update_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 0247a03477..77851d32d6 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -543,4 +543,59 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_empty out
end
+ def test_explain_platform_local
+ local = Gem::Platform.local
+ spec_fetcher do |fetcher|
+ fetcher.download 'a', 2
+
+ fetcher.download 'a', 2 do |s|
+ s.platform = local
+ end
+
+ fetcher.spec 'a', 1
+ end
+
+ @cmd.options[:explain] = true
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal "Gems to update:", out.shift
+ assert_equal " a-2-#{local}", out.shift
+ assert_empty out
+ end
+
+ def test_explain_platform_ruby
+ local = Gem::Platform.local
+ spec_fetcher do |fetcher|
+ fetcher.download 'a', 2
+
+ fetcher.download 'a', 2 do |s|
+ s.platform = local
+ end
+
+ fetcher.spec 'a', 1
+ end
+
+ # equivalent to --platform=ruby
+ Gem.platforms = [Gem::Platform::RUBY]
+
+ @cmd.options[:explain] = true
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal "Gems to update:", out.shift
+ assert_equal " a-2", out.shift
+ assert_empty out
+ end
+
end