diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-07-29 14:59:56 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-07-29 15:46:15 +0900 |
commit | bfd09b1116bcc747bab922b23c7322e4ec66c2c2 (patch) | |
tree | 38c52d7a1f5790f8902eb585267e5da5f9e76399 /spec/bundler/commands | |
parent | f29f1d22c3d62b72b8943eefb384cd7a52251ea1 (diff) | |
download | ruby-bfd09b1116bcc747bab922b23c7322e4ec66c2c2.tar.gz |
Merge rubygems master from https://github.com/rubygems/rubygems/commit/446cc57a7ccdf1924deb291be9571219e7ba8523
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r-- | spec/bundler/commands/install_spec.rb | 52 | ||||
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/commands/update_spec.rb | 10 |
3 files changed, 54 insertions, 12 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 57cff4e3b3..7bf36ee020 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -522,14 +522,14 @@ RSpec.describe "bundle install with gem sources" do ruby '~> 1.2' source "#{file_uri_for(gem_repo1)}" G - expect(err).to include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified ~> 1.2") + expect(err).to include("Your Ruby version is #{Gem.ruby_version}, but your Gemfile specified ~> 1.2") end end context "and using a supported Ruby version" do before do install_gemfile <<-G - ruby '~> #{RUBY_VERSION}' + ruby '~> #{Gem.ruby_version}' source "#{file_uri_for(gem_repo1)}" G end @@ -555,7 +555,7 @@ RSpec.describe "bundle install with gem sources" do it "updates Gemfile.lock with updated yet still compatible ruby version" do install_gemfile <<-G - ruby '~> #{RUBY_VERSION[0..2]}' + ruby '~> #{current_ruby_minor}' source "#{file_uri_for(gem_repo1)}" G @@ -913,7 +913,7 @@ RSpec.describe "bundle install with gem sources" do gemfile <<-G source "https://gem.repo4" - ruby "#{RUBY_VERSION}" + ruby "#{Gem.ruby_version}" gem "loofah", "~> 2.12.0" G @@ -1000,6 +1000,50 @@ RSpec.describe "bundle install with gem sources" do end end + context "with only option" do + before do + bundle "config set only a:b" + end + + it "installs only gems of the specified groups" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rails" + gem "rack", group: :a + gem "rake", group: :b + gem "yard", group: :c + G + + expect(out).to include("Installing rack") + expect(out).to include("Installing rake") + expect(out).not_to include("Installing yard") + end + end + + context "with --prefer-local flag" do + before do + build_repo4 do + build_gem "foo", "1.0.1" + build_gem "foo", "1.0.0" + build_gem "bar", "1.0.0" + end + + system_gems "foo-1.0.0", :path => default_bundle_path, :gem_repo => gem_repo4 + end + + it "fetches remote sources only when not available locally" do + install_gemfile <<-G, :"prefer-local" => true, :verbose => true + source "#{file_uri_for(gem_repo4)}" + + gem "foo" + gem "bar" + G + + expect(out).to include("Using foo 1.0.0").and include("Fetching bar 1.0.0").and include("Installing bar 1.0.0") + expect(last_command).to be_success + end + end + context "with a symlinked configured as bundle path and a gem with symlinks" do before do symlinked_bundled_app = tmp("bundled_app-symlink") diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index b20a6ded43..b314169a98 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -541,11 +541,9 @@ RSpec.describe "bundle lock" do end it "respects lower bound ruby requirements" do - skip "this spec does not work with prereleases because their version is actually lower than their reported `RUBY_VERSION`" if RUBY_PATCHLEVEL == -1 - build_repo4 do build_gem "our_private_gem", "0.1.0" do |s| - s.required_ruby_version = ">= #{RUBY_VERSION}" + s.required_ruby_version = ">= #{Gem.ruby_version}" end end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index d45a565475..8ca537ac10 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -983,7 +983,7 @@ RSpec.describe "bundle update --ruby" do context "when the Gemfile removes the ruby" do before do install_gemfile <<-G - ruby '~> #{RUBY_VERSION}' + ruby '~> #{Gem.ruby_version}' source "#{file_uri_for(gem_repo1)}" G @@ -1013,12 +1013,12 @@ RSpec.describe "bundle update --ruby" do context "when the Gemfile specified an updated Ruby version" do before do install_gemfile <<-G - ruby '~> #{RUBY_VERSION}' + ruby '~> #{Gem.ruby_version}' source "#{file_uri_for(gem_repo1)}" G gemfile <<-G - ruby '~> #{RUBY_VERSION[0..2]}' + ruby '~> #{current_ruby_minor}' source "#{file_uri_for(gem_repo1)}" G end @@ -1047,7 +1047,7 @@ RSpec.describe "bundle update --ruby" do context "when a different Ruby is being used than has been versioned" do before do install_gemfile <<-G - ruby '~> #{RUBY_VERSION}' + ruby '~> #{Gem.ruby_version}' source "#{file_uri_for(gem_repo1)}" G @@ -1083,7 +1083,7 @@ RSpec.describe "bundle update --ruby" do L gemfile <<-G - ruby '~> #{RUBY_VERSION}' + ruby '~> #{Gem.ruby_version}' source "#{file_uri_for(gem_repo1)}" G end |