diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-01-10 13:53:41 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-01-10 15:53:07 +0900 |
commit | a43f1d90c2b3aed232d5f4ef9dfe226401cf5d81 (patch) | |
tree | dcb61dd3ab8434242b81d54e8e16b4c4d86d5b8c /spec/bundler/commands | |
parent | 89fb61f9a3276121da2826b93f131e52d6449859 (diff) | |
download | ruby-a43f1d90c2b3aed232d5f4ef9dfe226401cf5d81.tar.gz |
Merge RubyGems and Bundler master
from https://github.com/rubygems/rubygems/commit/0635c1423db5d7c461d53bf0c3329bca75de7609
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r-- | spec/bundler/commands/add_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/commands/binstubs_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/commands/clean_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/doctor_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 55 | ||||
-rw-r--r-- | spec/bundler/commands/viz_spec.rb | 2 |
6 files changed, 63 insertions, 8 deletions
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index 36d7616949..5a5b534e8d 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -144,7 +144,7 @@ RSpec.describe "bundle add" do end describe "with --github" do - it "adds dependency with specified github source" do + it "adds dependency with specified github source", :realworld do bundle "add rake --github=ruby/rake" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake"}) @@ -152,7 +152,7 @@ RSpec.describe "bundle add" do end describe "with --github and --branch" do - it "adds dependency with specified github source and branch" do + it "adds dependency with specified github source and branch", :realworld do bundle "add rake --github=ruby/rake --branch=master" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake", :branch => "master"}) @@ -160,7 +160,7 @@ RSpec.describe "bundle add" do end describe "with --github and --ref" do - it "adds dependency with specified github source and ref" do + it "adds dependency with specified github source and ref", :realworld do bundle "add rake --github=ruby/rake --ref=5c60da8" expect(bundled_app_gemfile.read).to match(%r{gem "rake", "~> 13\.0", :github => "ruby\/rake", :ref => "5c60da8"}) diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 2634f43417..61a911621f 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -188,7 +188,7 @@ RSpec.describe "bundle binstubs <gem>" do lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 2.3.0") end - it "installs and runs the exact version of bundler", :rubygems => ">= 3.3.0.dev" do + it "installs and runs the exact version of bundler", :rubygems => ">= 3.3.0.dev", :realworld => true do sys_exec "bin/bundle install --verbose", :artifice => "vcr" expect(exitstatus).not_to eq(42) expect(out).to include("Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version.") @@ -224,7 +224,7 @@ RSpec.describe "bundle binstubs <gem>" do context "when update --bundler is called" do before { lockfile.gsub(system_bundler_version, "1.1.1") } - it "calls through to the latest bundler version" do + it "calls through to the latest bundler version", :realworld do sys_exec "bin/bundle update --bundler", :env => { "DEBUG" => "1" } using_bundler_line = /Using bundler ([\w\.]+)\n/.match(out) expect(using_bundler_line).to_not be_nil diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 2b83a71dae..471cd6c354 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -625,7 +625,7 @@ RSpec.describe "bundle clean" do expect(out).to eq("1.0") end - it "when using --force, it doesn't remove default gem binaries" do + it "when using --force, it doesn't remove default gem binaries", :realworld do skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0" skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2 diff --git a/spec/bundler/commands/doctor_spec.rb b/spec/bundler/commands/doctor_spec.rb index 1eeb276105..1afac00923 100644 --- a/spec/bundler/commands/doctor_spec.rb +++ b/spec/bundler/commands/doctor_spec.rb @@ -134,7 +134,7 @@ RSpec.describe "bundle doctor" do end end - context "when home contains filesname with special characters" do + context "when home contains filenames with special characters" do it "escape filename before command execute" do doctor = Bundler::CLI::Doctor.new({}) expect(doctor).to receive(:`).with("/usr/bin/otool -L \\$\\(date\\)\\ \\\"\\'\\\\.bundle").and_return("dummy string") diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index c80b9dc646..38bef77eaf 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -319,6 +319,61 @@ RSpec.describe "bundle lock" do expect(lockfile.platforms).to match_array([x86_mingw32, specific_local_platform].uniq) end + it "also cleans up redundant platform gems when removing platforms" do + build_repo4 do + build_gem "nokogiri", "1.12.0" + build_gem "nokogiri", "1.12.0" do |s| + s.platform = "x86_64-darwin" + end + end + + simulate_platform "x86_64-darwin-22" do + install_gemfile <<~G + source "#{file_uri_for(gem_repo4)}" + + gem "nokogiri" + G + end + + lockfile <<~L + GEM + remote: #{file_uri_for(gem_repo4)}/ + specs: + nokogiri (1.12.0) + nokogiri (1.12.0-x86_64-darwin) + + PLATFORMS + ruby + x86_64-darwin + + DEPENDENCIES + nokogiri + + BUNDLED WITH + #{Bundler::VERSION} + L + + simulate_platform "x86_64-darwin-22" do + bundle "lock --remove-platform ruby" + end + + expect(lockfile).to eq <<~L + GEM + remote: #{file_uri_for(gem_repo4)}/ + specs: + nokogiri (1.12.0-x86_64-darwin) + + PLATFORMS + x86_64-darwin + + DEPENDENCIES + nokogiri + + BUNDLED WITH + #{Bundler::VERSION} + L + end + it "errors when removing all platforms" do bundle "lock --remove-platform #{specific_local_platform}", :raise_on_error => false expect(err).to include("Removing all platforms from the bundle is not allowed") diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb index 811fc255ef..cf612397ab 100644 --- a/spec/bundler/commands/viz_spec.rb +++ b/spec/bundler/commands/viz_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot") do +RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :realworld => true do before do realworld_system_gems "ruby-graphviz --version 1.2.5" end |