summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_fetch_command.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-10-30 00:20:28 +0200
committergit <svn-admin@ruby-lang.org>2021-11-03 17:42:39 +0900
commitc5224c71aeba147a111131c16688a208c161ee75 (patch)
tree050056345107cc7bfa6093bbf5202fb4a9875323 /test/rubygems/test_gem_commands_fetch_command.rb
parent9fc7ea64a1deb1e342a54607d16b5cf7eb9ec351 (diff)
[rubygems/rubygems] Fix `gem install` vs `gem fetch` inconsistency
https://github.com/rubygems/rubygems/commit/b3e985799e
Diffstat (limited to 'test/rubygems/test_gem_commands_fetch_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_fetch_command.rb b/test/rubygems/test_gem_commands_fetch_command.rb
index 35ee00f763..c745648d56 100644
--- a/test/rubygems/test_gem_commands_fetch_command.rb
+++ b/test/rubygems/test_gem_commands_fetch_command.rb
@@ -79,6 +79,42 @@ class TestGemCommandsFetchCommand < Gem::TestCase
"#{a2.full_name} not fetched")
end
+ def test_execute_platform
+ a2_spec, a2 = util_gem("a", "2")
+
+ a2_universal_darwin_spec, a2_universal_darwin = util_gem("a", "2") do |s|
+ s.platform = 'universal-darwin'
+ end
+
+ Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
+
+ write_marshalled_gemspecs(a2_spec, a2_universal_darwin_spec)
+
+ @cmd.options[:args] = %w[a]
+
+ @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = util_gzip(Marshal.dump([
+ Gem::NameTuple.new(a2_spec.name, a2_spec.version, a2_spec.platform),
+ Gem::NameTuple.new(a2_universal_darwin_spec.name, a2_universal_darwin_spec.version, a2_universal_darwin_spec.platform),
+ ]))
+
+ @fetcher.data["#{@gem_repo}gems/#{a2_spec.file_name}"] = Gem.read_binary(a2)
+ FileUtils.cp a2, a2_spec.cache_file
+
+ @fetcher.data["#{@gem_repo}gems/#{a2_universal_darwin_spec.file_name}"] = Gem.read_binary(a2_universal_darwin)
+ FileUtils.cp a2_universal_darwin, a2_universal_darwin_spec.cache_file
+
+ util_set_arch 'arm64-darwin20' do
+ use_ui @ui do
+ Dir.chdir @tempdir do
+ @cmd.execute
+ end
+ end
+ end
+
+ assert_path_exist(File.join(@tempdir, a2_universal_darwin_spec.file_name),
+ "#{a2_universal_darwin_spec.full_name} not fetched")
+ end
+
def test_execute_specific_prerelease
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 2