summaryrefslogtreecommitdiff
path: root/spec/bundler/cache/gems_spec.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-10-11 19:59:46 +0200
committergit <svn-admin@ruby-lang.org>2021-10-13 16:21:42 +0900
commitbd87397f73c36f1428b4cf8de24918b98fa71c8a (patch)
treecfade99e157243a1a79d38893e6a43c5a6690eb5 /spec/bundler/cache/gems_spec.rb
parentd6627ab85c7e29a45ee61af350a38c37ea2bd83b (diff)
[rubygems/rubygems] Use correct way to detect default gems
The other way, in particular matching a substring in the gemspec summary, is brittle and no longer used since Ruby 2.0. This needed rewriting the specs that depended on that way. https://github.com/rubygems/rubygems/commit/059dbfa971
Diffstat (limited to 'spec/bundler/cache/gems_spec.rb')
-rw-r--r--spec/bundler/cache/gems_spec.rb24
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 72e372fb41..a8382a5d8c 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -89,35 +89,33 @@ RSpec.describe "bundle cache" do
it_behaves_like "when there are only gemsources"
end
- describe "when there is a built-in gem" do
+ describe "when there is a built-in gem", :ruby_repo do
+ let(:default_json_version) { ruby "gem 'json'; require 'json'; puts JSON::VERSION" }
+
before :each do
build_repo2 do
- build_gem "builtin_gem", "1.0.2"
- end
-
- build_gem "builtin_gem", "1.0.2", :to_system => true do |s|
- s.summary = "This builtin_gem is bundled with Ruby"
+ build_gem "json", default_json_version
end
- FileUtils.rm("#{system_gem_path}/cache/builtin_gem-1.0.2.gem")
+ build_gem "json", default_json_version, :to_system => true, :default => true
end
it "uses builtin gems when installing to system gems" do
bundle "config set path.system true"
- install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'builtin_gem', '1.0.2')
- expect(the_bundle).to include_gems("builtin_gem 1.0.2")
+ install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'json', '#{default_json_version}'), :verbose => true
+ expect(out).to include("Using json #{default_json_version}")
end
it "caches remote and builtin gems" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
- gem 'builtin_gem', '1.0.2'
+ gem 'json', '#{default_json_version}'
gem 'rack', '1.0.0'
G
bundle :cache
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
- expect(bundled_app("vendor/cache/builtin_gem-1.0.2.gem")).to exist
+ expect(bundled_app("vendor/cache/json-#{default_json_version}.gem")).to exist
end
it "doesn't make remote request after caching the gem" do
@@ -139,12 +137,12 @@ RSpec.describe "bundle cache" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
- gem 'builtin_gem', '1.0.2'
+ gem 'json', '#{default_json_version}'
G
bundle :cache, :raise_on_error => false
expect(exitstatus).to_not eq(0)
- expect(err).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached")
+ expect(err).to include("json-#{default_json_version} is built in to Ruby, and can't be cached")
end
end