summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-12-24 09:32:59 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-12-24 10:35:31 +0900
commitb0ad6cb371747a04eb12580e74c73179173cc89d (patch)
treeee873d5c682c4665c838e3ea43585536229a5509 /test
parentde0523feddf740d28fe772f3a22ff9907f88bf69 (diff)
Merge RubyGems-3.3.2 and Bundler-2.3.2
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5334
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb33
-rw-r--r--test/rubygems/test_gem_installer.rb27
2 files changed, 33 insertions, 27 deletions
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 535180983b..0365b2c408 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -782,6 +782,39 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_match "1 gem installed", @ui.output
end
+ def test_execute_remote_truncates_existing_gemspecs
+ spec_fetcher do |fetcher|
+ fetcher.gem 'a', 1
+ end
+
+ @cmd.options[:domain] = :remote
+
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal %w[a-1], @cmd.installed_specs.map {|spec| spec.full_name }
+ assert_match "1 gem installed", @ui.output
+
+ a1_gemspec = File.join(@gemhome, 'specifications', "a-1.gemspec")
+
+ initial_a1_gemspec_content = File.read(a1_gemspec)
+ modified_a1_gemspec_content = initial_a1_gemspec_content + "\n # AAAAAAA\n"
+ File.write(a1_gemspec, modified_a1_gemspec_content)
+
+ use_ui @ui do
+ assert_raise Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ assert_equal initial_a1_gemspec_content, File.read(a1_gemspec)
+ end
+
def test_execute_remote_ignores_files
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 1
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index dae2b070d5..8874577aa8 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -288,33 +288,6 @@ gem 'other', version
"(SyntaxError)", e.message
end
- def test_ensure_no_race_conditions_between_installing_and_loading_gemspecs
- a, a_gem = util_gem 'a', 2
-
- Gem::Installer.at(a_gem).install
-
- t1 = Thread.new do
- 5.times do
- Gem::Installer.at(a_gem).install
- sleep 0.1
- end
- end
-
- t2 = Thread.new do
- _, err = capture_output do
- 20.times do
- Gem::Specification.load(a.spec_file)
- Gem::Specification.send(:clear_load_cache)
- end
- end
-
- assert_empty err
- end
-
- t1.join
- t2.join
- end
-
def test_ensure_loadable_spec_security_policy
pend 'openssl is missing' unless Gem::HAVE_OPENSSL