[前][次][番号順一覧][スレッド一覧]

ruby-changes:70614

From: David <ko1@a...>
Date: Mon, 27 Dec 2021 10:46:03 +0900 (JST)
Subject: [ruby-changes:70614] ca3a2e46e8 (master): [rubygems/rubygems] Update some specs to pass ruby-head CI

https://git.ruby-lang.org/ruby.git/commit/?id=ca3a2e46e8

From ca3a2e46e8098bc66e2ab1589934bb40f00b78b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Sun, 26 Dec 2021 17:41:21 +0100
Subject: [rubygems/rubygems] Update some specs to pass ruby-head CI

These specs were monkeypatching `RUBY_VERSION`, but that obviously
doesn't change the running ruby to behave any different.

The removal of some features, in particular, `String#untaint`, made
these specs fail, because untaint is no longer available under ruby-core
and bundler calls `untaint` when `RUBY_VERSION` is less than "2.7",
which these specs were overwriting it to be.

Rewrite these specs to not overwrite `RUBY_VERSION`, but still test the
same things.

https://github.com/rubygems/rubygems/commit/e8c7b92901
---
 spec/bundler/commands/install_spec.rb | 19 +++++------
 spec/bundler/commands/update_spec.rb  | 59 ++++++++++++++++++++++-------------
 2 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index e00caa53153..ec1d9bcd027 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -499,20 +499,17 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L499
     context "and using an unsupported Ruby version" do
       it "prints an error" do
         install_gemfile <<-G, :raise_on_error => false
-          ::RUBY_VERSION = '2.0.1'
-          ruby '~> 2.2'
+          ruby '~> 1.2'
           source "#{file_uri_for(gem_repo1)}"
         G
-        expect(err).to include("Your Ruby version is 2.0.1, but your Gemfile specified ~> 2.2")
+        expect(err).to include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified ~> 1.2")
       end
     end
 
     context "and using a supported Ruby version" do
       before do
         install_gemfile <<-G
-          ::RUBY_VERSION = '2.1.3'
-          ::RUBY_PATCHLEVEL = 100
-          ruby '~> 2.1.0'
+          ruby '~> #{RUBY_VERSION}'
           source "#{file_uri_for(gem_repo1)}"
         G
       end
@@ -529,18 +526,16 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L526
          DEPENDENCIES
 
          RUBY VERSION
-            ruby 2.1.3p100
+            #{Bundler::RubyVersion.system}
 
          BUNDLED WITH
             #{Bundler::VERSION}
         L
       end
 
-      it "updates Gemfile.lock with updated incompatible ruby version" do
+      it "updates Gemfile.lock with updated yet still compatible ruby version" do
         install_gemfile <<-G
-          ::RUBY_VERSION = '2.2.3'
-          ::RUBY_PATCHLEVEL = 100
-          ruby '~> 2.2.0'
+          ruby '~> #{RUBY_VERSION[0..2]}'
           source "#{file_uri_for(gem_repo1)}"
         G
 
@@ -555,7 +550,7 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L550
          DEPENDENCIES
 
          RUBY VERSION
-            ruby 2.2.3p100
+            #{Bundler::RubyVersion.system}
 
          BUNDLED WITH
             #{Bundler::VERSION}
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index 403a48a508c..42cb0f31576 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -980,20 +980,14 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L980
 end
 
 RSpec.describe "bundle update --ruby" do
-  before do
-    install_gemfile <<-G
-        ::RUBY_VERSION = '2.1.3'
-        ::RUBY_PATCHLEVEL = 100
-        ruby '~> 2.1.0'
-        source "#{file_uri_for(gem_repo1)}"
-    G
-  end
-
   context "when the Gemfile removes the ruby" do
     before do
+      install_gemfile <<-G
+        ruby '~> #{RUBY_VERSION}'
+        source "#{file_uri_for(gem_repo1)}"
+      G
+
       gemfile <<-G
-          ::RUBY_VERSION = '2.1.4'
-          ::RUBY_PATCHLEVEL = 222
           source "#{file_uri_for(gem_repo1)}"
       G
     end
@@ -1018,10 +1012,13 @@ RSpec.describe "bundle update --ruby" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1012
 
   context "when the Gemfile specified an updated Ruby version" do
     before do
+      install_gemfile <<-G
+        ruby '~> #{RUBY_VERSION}'
+        source "#{file_uri_for(gem_repo1)}"
+      G
+
       gemfile <<-G
-          ::RUBY_VERSION = '2.1.4'
-          ::RUBY_PATCHLEVEL = 222
-          ruby '~> 2.1.0'
+          ruby '~> #{RUBY_VERSION[0..2]}'
           source "#{file_uri_for(gem_repo1)}"
       G
     end
@@ -1039,7 +1036,7 @@ RSpec.describe "bundle update --ruby" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1036
        DEPENDENCIES
 
        RUBY VERSION
-          ruby 2.1.4p222
+          #{Bundler::RubyVersion.system}
 
        BUNDLED WITH
           #{Bundler::VERSION}
@@ -1049,9 +1046,12 @@ RSpec.describe "bundle update --ruby" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1046
 
   context "when a different Ruby is being used than has been versioned" do
     before do
+      install_gemfile <<-G
+        ruby '~> #{RUBY_VERSION}'
+        source "#{file_uri_for(gem_repo1)}"
+      G
+
       gemfile <<-G
-          ::RUBY_VERSION = '2.2.2'
-          ::RUBY_PATCHLEVEL = 505
           ruby '~> 2.1.0'
           source "#{file_uri_for(gem_repo1)}"
       G
@@ -1059,16 +1059,31 @@ RSpec.describe "bundle update --ruby" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1059
     it "shows a helpful error message" do
       bundle "update --ruby", :raise_on_error => false
 
-      expect(err).to include("Your Ruby version is 2.2.2, but your Gemfile specified ~> 2.1.0")
+      expect(err).to include("Your Ruby version is #{Bundler::RubyVersion.system.gem_version}, but your Gemfile specified ~> 2.1.0")
     end
   end
 
   context "when updating Ruby version and Gemfile `ruby`" do
     before do
+      lockfile <<~L
+       GEM
+         remote: #{file_uri_for(gem_repo1)}/
+         specs:
+
+       PLATFORMS
+         #{lockfile_platforms}
+
+       DEPENDENCIES
+
+       RUBY VERSION
+          ruby 2.1.4p222
+
+       BUNDLED WITH
+          #{Bundler::VERSION}
+      L
+
       gemfile <<-G
-          ::RUBY_VERSION = '1.8.3'
-          ::RUBY_PATCHLEVEL = 55
-          ruby '~> 1.8.0'
+          ruby '~> #{RUBY_VERSION}'
           source "#{file_uri_for(gem_repo1)}"
       G
     end
@@ -1086,7 +1101,7 @@ RSpec.describe "bundle update --ruby" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/update_spec.rb#L1101
        DEPENDENCIES
 
        RUBY VERSION
-          ruby 1.8.3p55
+          #{Bundler::RubyVersion.system}
 
        BUNDLED WITH
           #{Bundler::VERSION}
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]