summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-17 16:11:25 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2024-10-17 08:55:01 -0700
commitd03e4228aaeb1bdd3432119e683aa259b028c5b2 (patch)
treec8e063bba20531ca9271cd440bb6ef2edcdf2b2c /spec
parentaf7656869ee714a7124c1c655bc905e456770bd2 (diff)
Merge RubyGems-3.5.21 and Bundler-2.5.21
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/endpoint_specification_spec.rb2
-rw-r--r--spec/bundler/bundler/stub_specification_spec.rb20
-rw-r--r--spec/bundler/cache/git_spec.rb2
-rw-r--r--spec/bundler/install/deploy_spec.rb25
-rw-r--r--spec/bundler/install/gemfile/force_ruby_platform_spec.rb2
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb2
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile2
-rw-r--r--spec/bundler/realworld/fixtures/warbler/Gemfile.lock6
-rw-r--r--spec/bundler/runtime/env_helpers_spec.rb (renamed from spec/bundler/runtime/with_unbundled_env_spec.rb)11
-rw-r--r--spec/bundler/runtime/inline_spec.rb16
10 files changed, 77 insertions, 11 deletions
diff --git a/spec/bundler/bundler/endpoint_specification_spec.rb b/spec/bundler/bundler/endpoint_specification_spec.rb
index e7e10730cf..6518f125ba 100644
--- a/spec/bundler/bundler/endpoint_specification_spec.rb
+++ b/spec/bundler/bundler/endpoint_specification_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe Bundler::EndpointSpecification do
expect { subject }.to raise_error(
Bundler::GemspecError,
a_string_including("There was an error parsing the metadata for the gem foo (1.0.0)").
- and(a_string_including('The metadata was {"rubygems"=>">\n"}'))
+ and(a_string_including("The metadata was #{{ "rubygems" => ">\n" }.inspect}"))
)
end
end
diff --git a/spec/bundler/bundler/stub_specification_spec.rb b/spec/bundler/bundler/stub_specification_spec.rb
index dae9f3cfba..beb966b3ce 100644
--- a/spec/bundler/bundler/stub_specification_spec.rb
+++ b/spec/bundler/bundler/stub_specification_spec.rb
@@ -55,4 +55,24 @@ RSpec.describe Bundler::StubSpecification do
expect(stub.missing_extensions?).to be true
end
end
+
+ describe "#activated?" do
+ it "returns true after activation" do
+ stub = described_class.from_stub(with_bundler_stub_spec)
+
+ expect(stub.activated?).to be_falsey
+ stub.activated = true
+ expect(stub.activated?).to be true
+ end
+
+ it "returns true after activation if the underlying stub is a `Gem::StubSpecification`" do
+ spec_path = File.join(File.dirname(__FILE__), "specifications", "foo.gemspec")
+ gem_stub = Gem::StubSpecification.new(spec_path, File.dirname(__FILE__),"","")
+ stub = described_class.from_stub(gem_stub)
+
+ expect(stub.activated?).to be_falsey
+ stub.activated = true
+ expect(stub.activated?).to be true
+ end
+ end
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 88436c79aa..ea91829003 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -323,8 +323,6 @@ RSpec.describe "bundle cache with git" do
FileUtils.mkdir_p bundled_app("vendor/cache")
FileUtils.cp_r git_path, bundled_app("vendor/cache/foo-1.0-#{path_revision}")
FileUtils.rm_rf bundled_app("vendor/cache/foo-1.0-#{path_revision}/.git")
- # bundle install with git repo needs to be run under the git environment.
- Dir.chdir(bundled_app) { system(*%W[git init --quiet]) }
bundle :install, env: { "BUNDLE_DEPLOYMENT" => "true", "BUNDLE_CACHE_ALL" => "true" }
end
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 7b6e775b4c..bd39ac5cc1 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -438,7 +438,7 @@ RSpec.describe "install in deployment or frozen mode" do
expect(err).to include("You have changed in the Gemfile:\n* myrack from `no specified source` to `git://hubz.com`")
end
- it "explodes if you change a source" do
+ it "explodes if you change a source from git to the default" do
build_git "myrack"
install_gemfile <<-G
@@ -459,7 +459,7 @@ RSpec.describe "install in deployment or frozen mode" do
expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack-1.0")}` to `no specified source`")
end
- it "explodes if you change a source" do
+ it "explodes if you change a source from git to the default, in presence of other git sources" do
build_lib "foo", path: lib_path("myrack/foo")
build_git "myrack", path: lib_path("myrack")
@@ -483,6 +483,27 @@ RSpec.describe "install in deployment or frozen mode" do
expect(err).not_to include("You have deleted from the Gemfile")
end
+ it "explodes if you change a source from path to git" do
+ build_git "myrack", path: lib_path("myrack")
+
+ install_gemfile <<-G
+ source "https://gem.repo1"
+ gem "myrack", :path => "#{lib_path("myrack")}"
+ G
+
+ gemfile <<-G
+ source "https://gem.repo1"
+ gem "myrack", :git => "https:/my-git-repo-for-myrack"
+ G
+
+ bundle "config set --local frozen true"
+ bundle :install, raise_on_error: false
+ expect(err).to include("frozen mode")
+ expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack")}` to `https:/my-git-repo-for-myrack`")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ end
+
it "remembers that the bundle is frozen at runtime" do
bundle :lock
diff --git a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb
index f5d993adac..926e7527e6 100644
--- a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb
+++ b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb
@@ -102,6 +102,8 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do
end
it "reinstalls the ruby variant when a platform specific variant is already installed, the lockile has only ruby platform, and :force_ruby_platform is used in the Gemfile" do
+ skip "Can't simulate platform reliably on JRuby, installing a platform specific gem fails to activate io-wait because only the -java version is present, and we're simulating a different platform" if RUBY_ENGINE == "jruby"
+
lockfile <<-L
GEM
remote: https://gem.repo4
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 39064e3b80..4653ce6d87 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -173,7 +173,7 @@ RSpec.describe "compact index api" do
bundle :install, verbose: true, artifice: "compact_index_checksum_mismatch"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(out).to include("The checksum of /versions does not match the checksum provided by the server!")
- expect(out).to include('Calculated checksums {"sha-256"=>"8KfZiM/fszVkqhP/m5s9lvE6M9xKu4I1bU4Izddp5Ms="} did not match expected {"sha-256"=>"ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="}')
+ expect(out).to include("Calculated checksums #{{ "sha-256" => "8KfZiM/fszVkqhP/m5s9lvE6M9xKu4I1bU4Izddp5Ms=" }.inspect} did not match expected #{{ "sha-256" => "ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0=" }.inspect}")
expect(the_bundle).to include_gems "myrack 1.0.0"
end
diff --git a/spec/bundler/realworld/fixtures/warbler/Gemfile b/spec/bundler/realworld/fixtures/warbler/Gemfile
index a8dbb4911c..e4d3e8ea96 100644
--- a/spec/bundler/realworld/fixtures/warbler/Gemfile
+++ b/spec/bundler/realworld/fixtures/warbler/Gemfile
@@ -3,5 +3,5 @@
source "https://rubygems.org"
gem "demo", path: "./demo"
-gem "jruby-jars", "~> 9.2"
+gem "jruby-jars", "~> 9.4"
gem "warbler", "~> 2.0"
diff --git a/spec/bundler/realworld/fixtures/warbler/Gemfile.lock b/spec/bundler/realworld/fixtures/warbler/Gemfile.lock
index 5b476f8df2..b8171d28ce 100644
--- a/spec/bundler/realworld/fixtures/warbler/Gemfile.lock
+++ b/spec/bundler/realworld/fixtures/warbler/Gemfile.lock
@@ -6,7 +6,7 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- jruby-jars (9.2.16.0)
+ jruby-jars (9.4.8.0)
jruby-rack (1.1.21)
rake (13.0.1)
rubyzip (1.3.0)
@@ -23,8 +23,8 @@ PLATFORMS
DEPENDENCIES
demo!
- jruby-jars (~> 9.2)
+ jruby-jars (~> 9.4)
warbler (~> 2.0)
BUNDLED WITH
- 2.5.0.dev
+ 2.6.0.dev
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/env_helpers_spec.rb
index 8c3582f7ac..a1607cd057 100644
--- a/spec/bundler/runtime/with_unbundled_env_spec.rb
+++ b/spec/bundler/runtime/env_helpers_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "Bundler.with_env helpers" do
+RSpec.describe "env helpers" do
def bundle_exec_ruby(args, options = {})
build_bundler_context options.dup
bundle "exec '#{Gem.ruby}' #{args}", options
@@ -103,6 +103,15 @@ RSpec.describe "Bundler.with_env helpers" do
expect(last_command.stdboth).not_to include("-rbundler/setup")
end
+ it "should delete BUNDLER_SETUP even if it was present in original env" do
+ create_file("source.rb", <<-RUBY)
+ print #{modified_env}.has_key?('BUNDLER_SETUP')
+ RUBY
+ ENV["BUNDLER_ORIG_BUNDLER_SETUP"] = system_gem_path("gems/bundler-#{Bundler::VERSION}/lib/bundler/setup").to_s
+ bundle_exec_ruby bundled_app("source.rb")
+ expect(last_command.stdboth).to include "false"
+ end
+
it "should restore RUBYLIB", :ruby_repo do
create_file("source.rb", <<-RUBY)
print #{modified_env}['RUBYLIB']
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 5ff555ab0d..5be6eef7bd 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -670,6 +670,22 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to be_empty
end
+ it "does not reset ENV" do
+ script <<-RUBY
+ require 'bundler/inline'
+
+ gemfile do
+ source "https://gem.repo1"
+
+ ENV['FOO'] = 'bar'
+ end
+
+ puts ENV['FOO']
+ RUBY
+
+ expect(out).to eq("bar")
+ end
+
it "does not load specified version of psych and stringio", :ruby_repo do
build_repo4 do
build_gem "psych", "999"