summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorTakuya Noguchi <takninnovationresearch@gmail.com>2022-10-27 20:23:37 +0000
committergit <svn-admin@ruby-lang.org>2026-03-25 02:52:06 +0000
commite733916facb2ac01ba4ab8fdbc87f269b8221ce0 (patch)
tree1ce82c65b25c46590a0809f07b0b25ed42bcdd90 /spec/bundler/commands
parent6337aba3a4fad2708923872623275aa7450459f5 (diff)
[ruby/rubygems] Bundler: ignore patchlevel kwarg in ruby DSL
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com> https://github.com/ruby/rubygems/commit/bc40cc6ef6
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/platform_spec.rb80
1 files changed, 48 insertions, 32 deletions
diff --git a/spec/bundler/commands/platform_spec.rb b/spec/bundler/commands/platform_spec.rb
index 1e233e0917..7b9499d509 100644
--- a/spec/bundler/commands/platform_spec.rb
+++ b/spec/bundler/commands/platform_spec.rb
@@ -302,9 +302,9 @@ G
expect(err).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
end
- def should_be_patchlevel_incorrect
- expect(exitstatus).to eq(18)
- expect(err).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}")
+ def should_ignore_patchlevel
+ expect(exitstatus).to eq(0)
+ expect(err).to eq("")
end
def should_be_patchlevel_fixnum
@@ -382,7 +382,7 @@ G
should_be_engine_version_incorrect
end
- it "doesn't install when patchlevel doesn't match" do
+ it "does install even when patchlevel doesn't match" do
install_gemfile <<-G, raise_on_error: false
source "https://gem.repo1"
gem "myrack"
@@ -390,8 +390,8 @@ G
#{patchlevel_incorrect}
G
- expect(bundled_app_lock).not_to exist
- should_be_patchlevel_incorrect
+ expect(bundled_app_lock).to exist
+ should_ignore_patchlevel
end
end
@@ -481,7 +481,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "checks fine even when patchlevel doesn't match" do
install_gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -494,8 +494,8 @@ G
#{patchlevel_incorrect}
G
- bundle :check, raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle :check
+ should_ignore_patchlevel
end
end
@@ -598,7 +598,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "updates fine even when patchlevel doesn't match" do
gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -609,8 +609,9 @@ G
build_gem "activesupport", "3.0"
end
- bundle :update, all: true, raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle :update, all: true
+ should_ignore_patchlevel
+ expect(the_bundle).to include_gems "myrack 1.2", "activesupport 3.0"
end
end
@@ -682,7 +683,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "prints path even when patchlevel doesn't match" do
gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -693,8 +694,9 @@ G
build_gem "activesupport", "3.0"
end
- bundle "show rails", raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle "show myrack"
+ should_ignore_patchlevel
+ expect(out).to eq(default_bundle_path("gems", "myrack-1.0.0").to_s)
end
end
@@ -766,7 +768,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "copies the .gem file to vendor/cache even when patchlevel doesn't match" do
gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -774,8 +776,9 @@ G
#{patchlevel_incorrect}
G
- bundle :cache, raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle :cache
+ should_ignore_patchlevel
+ expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist
end
end
@@ -847,7 +850,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "copies the .gem file to vendor/cache even when patchlevel doesn't match" do
gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -855,8 +858,9 @@ G
#{patchlevel_incorrect}
G
- bundle :cache, raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle :cache
+ should_ignore_patchlevel
+ expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist
end
end
@@ -926,7 +930,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "activates the correct gem even when patchlevel doesn't match" do
gemfile <<-G
source "https://gem.repo1"
gem "myrack"
@@ -934,8 +938,9 @@ G
#{patchlevel_incorrect}
G
- bundle "exec myrackup", raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle "exec myrackup"
+ should_ignore_patchlevel
+ expect(out).to include("1.0.0")
end
end
@@ -995,11 +1000,15 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "starts IRB with the default group loaded even when patchlevel doesn't match", :readline do
gemfile gemfile + "\n\n#{patchlevel_incorrect}\n"
- bundle "console", raise_on_error: false
- should_be_patchlevel_incorrect
+ bundle "console" do |input, _, _|
+ input.puts("puts MYRACK")
+ input.puts("exit")
+ end
+ should_ignore_patchlevel
+ expect(out).to include("0.9.1")
end
end
@@ -1095,7 +1104,7 @@ G
should_be_engine_version_incorrect
end
- it "fails when patchlevel doesn't match" do
+ it "makes a Gemfile.lock even when patchlevel doesn't match" do
install_gemfile <<-G, raise_on_error: false
source "https://gem.repo1"
gem "yard"
@@ -1106,10 +1115,10 @@ G
FileUtils.rm(bundled_app_lock)
- ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }, raise_on_error: false
+ ruby "require 'bundler/setup'", env: { "BUNDLER_VERSION" => Bundler::VERSION }
- expect(bundled_app_lock).not_to exist
- should_be_patchlevel_incorrect
+ should_ignore_patchlevel
+ expect(bundled_app_lock).to exist
end
end
@@ -1246,7 +1255,14 @@ G
G
bundle "outdated", raise_on_error: false
- should_be_patchlevel_incorrect
+ should_ignore_patchlevel
+ expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
+ Gem Current Latest Requested Groups
+ activesupport 2.3.5 3.0 = 2.3.5 default
+ foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default
+ TABLE
+
+ expect(out).to match(Regexp.new(expected_output))
end
it "fails when the patchlevel is a fixnum", :jruby_only do