ruby-changes:63165
From: Ellen <ko1@a...>
Date: Mon, 28 Sep 2020 14:54:52 +0900 (JST)
Subject: [ruby-changes:63165] e8274a7683 (master): [rubygems/rubygems] Add test for "gem update --system --silent"
https://git.ruby-lang.org/ruby.git/commit/?id=e8274a7683 From e8274a7683645082e96ced6a00d2df9ba10942ed Mon Sep 17 00:00:00 2001 From: Ellen Marie Dash <me@d...> Date: Thu, 30 Jul 2020 17:24:05 -0400 Subject: [rubygems/rubygems] Add test for "gem update --system --silent" https://github.com/rubygems/rubygems/commit/c3fb0db930 diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 2df6a48..b7609ed 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -174,13 +174,13 @@ command to remove old versions. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L174 update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}" Dir.chdir update_dir do - say "Installing RubyGems #{version}" + say "Installing RubyGems #{version}" unless options[:silent] installed = preparing_gem_layout_for(version) do system Gem.ruby, '--disable-gems', 'setup.rb', *args end - say "RubyGems system software updated" if installed + say "RubyGems system software updated" if installed unless options[:silent] end end diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb index eed799c..cacde06 100644 --- a/test/rubygems/test_gem_commands_update_command.rb +++ b/test/rubygems/test_gem_commands_update_command.rb @@ -276,6 +276,34 @@ class TestGemCommandsUpdateCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_update_command.rb#L276 Gem.disable_system_update_message = old_disable_system_update_message end + # The other style of `gem update --system` tests don't actually run + # setup.rb, so we just check that setup.rb gets the `--silent` flag. + def test_execute_system_silent_passed_to_setuprb + @cmd.options[:args] = [] + @cmd.options[:system] = true + @cmd.options[:silent] = true + + assert_equal true, @cmd.update_rubygems_arguments.include?('--silent') + end + + def test_execute_system_silent + spec_fetcher do |fetcher| + fetcher.download 'rubygems-update', 9 do |s| + s.files = %w[setup.rb] + end + end + + @cmd.options[:args] = [] + @cmd.options[:system] = true + @cmd.options[:silent] = true + + use_ui @ui do + @cmd.execute + end + + assert_empty @ui.output + end + # before: # a1 -> c1.2 # after: -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/