diff options
author | David RodrÃguez <[email protected]> | 2023-12-07 22:10:33 +0100 |
---|---|---|
committer | git <[email protected]> | 2023-12-07 22:29:33 +0000 |
commit | 2755cb1b2fbc4a5f08ca56345b5945bd452da74e (patch) | |
tree | 3b4500389edac16971410262ec331bae515e29e4 /spec/bundler/runtime | |
parent | 9d696aa20461d94c2d32e1e474bd036ade20c94d (diff) |
[rubygems/rubygems] Use modern hashes consistently
https://github.com/rubygems/rubygems/commit/bb66253f2c
Diffstat (limited to 'spec/bundler/runtime')
-rw-r--r-- | spec/bundler/runtime/executable_spec.rb | 22 | ||||
-rw-r--r-- | spec/bundler/runtime/gem_tasks_spec.rb | 10 | ||||
-rw-r--r-- | spec/bundler/runtime/inline_spec.rb | 26 | ||||
-rw-r--r-- | spec/bundler/runtime/platform_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/runtime/require_spec.rb | 10 | ||||
-rw-r--r-- | spec/bundler/runtime/requiring_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/runtime/self_management_spec.rb | 14 | ||||
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 88 | ||||
-rw-r--r-- | spec/bundler/runtime/with_unbundled_env_spec.rb | 8 |
9 files changed, 95 insertions, 95 deletions
diff --git a/spec/bundler/runtime/executable_spec.rb b/spec/bundler/runtime/executable_spec.rb index a11f547648..36ce6dcf67 100644 --- a/spec/bundler/runtime/executable_spec.rb +++ b/spec/bundler/runtime/executable_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "Running bin/* commands" do it "runs the bundled command when in the bundle" do bundle "binstubs rack" - build_gem "rack", "2.0", :to_system => true do |s| + build_gem "rack", "2.0", to_system: true do |s| s.executables = "rackup" end @@ -20,7 +20,7 @@ RSpec.describe "Running bin/* commands" do end it "allows the location of the gem stubs to be specified" do - bundle "binstubs rack", :path => "gbin" + bundle "binstubs rack", path: "gbin" expect(bundled_app("bin")).not_to exist expect(bundled_app("gbin/rackup")).to exist @@ -30,7 +30,7 @@ RSpec.describe "Running bin/* commands" do end it "allows absolute paths as a specification of where to install bin stubs" do - bundle "binstubs rack", :path => tmp("bin") + bundle "binstubs rack", path: tmp("bin") gembin tmp("bin/rackup") expect(out).to eq("1.0.0") @@ -42,23 +42,23 @@ RSpec.describe "Running bin/* commands" do end it "allows the name of the shebang executable to be specified" do - bundle "binstubs rack", :shebang => "ruby-foo" + bundle "binstubs rack", shebang: "ruby-foo" expect(File.readlines(bundled_app("bin/rackup")).first).to eq("#!/usr/bin/env ruby-foo\n") end it "runs the bundled command when out of the bundle" do bundle "binstubs rack" - build_gem "rack", "2.0", :to_system => true do |s| + build_gem "rack", "2.0", to_system: true do |s| s.executables = "rackup" end - gembin "rackup", :dir => tmp + gembin "rackup", dir: tmp expect(out).to eq("1.0.0") end it "works with gems in path" do - build_lib "rack", :path => lib_path("rack") do |s| + build_lib "rack", path: lib_path("rack") do |s| s.executables = "rackup" end @@ -69,7 +69,7 @@ RSpec.describe "Running bin/* commands" do bundle "binstubs rack" - build_gem "rack", "2.0", :to_system => true do |s| + build_gem "rack", "2.0", to_system: true do |s| s.executables = "rackup" end @@ -94,7 +94,7 @@ RSpec.describe "Running bin/* commands" do expect(bundled_app("bin/rackup")).not_to exist end - it "allows you to stop installing binstubs", :bundler => "< 3" do + it "allows you to stop installing binstubs", bundler: "< 3" do skip "delete permission error" if Gem.win_platform? bundle "install --binstubs bin/" @@ -107,13 +107,13 @@ RSpec.describe "Running bin/* commands" do expect(out).to include("You have not configured a value for `bin`") end - it "remembers that the option was specified", :bundler => "< 3" do + it "remembers that the option was specified", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "activesupport" G - bundle :install, :binstubs => "bin" + bundle :install, binstubs: "bin" gemfile <<-G source "#{file_uri_for(gem_repo1)}" diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb index b89fdf2cb1..f7afc0eb92 100644 --- a/spec/bundler/runtime/gem_tasks_spec.rb +++ b/spec/bundler/runtime/gem_tasks_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "includes the relevant tasks" do with_gem_path_as(base_system_gem_path.to_s) do - sys_exec "#{rake} -T", :env => { "GEM_HOME" => system_gem_path.to_s } + sys_exec "#{rake} -T", env: { "GEM_HOME" => system_gem_path.to_s } end expect(err).to be_empty @@ -45,7 +45,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "defines a working `rake install` task", :ruby_repo do with_gem_path_as(base_system_gem_path.to_s) do - sys_exec "#{rake} install", :env => { "GEM_HOME" => system_gem_path.to_s } + sys_exec "#{rake} install", env: { "GEM_HOME" => system_gem_path.to_s } end expect(err).to be_empty @@ -59,7 +59,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do before do spaced_bundled_app = tmp.join("bundled app") FileUtils.cp_r bundled_app, spaced_bundled_app - bundle "exec rake build", :dir => spaced_bundled_app + bundle "exec rake build", dir: spaced_bundled_app end it "still runs successfully" do @@ -71,7 +71,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do before do bracketed_bundled_app = tmp.join("bundled[app") FileUtils.cp_r bundled_app, bracketed_bundled_app - bundle "exec rake build", :dir => bracketed_bundled_app + bundle "exec rake build", dir: bracketed_bundled_app end it "still runs successfully" do @@ -99,7 +99,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do it "adds 'pkg' to rake/clean's CLOBBER" do with_gem_path_as(base_system_gem_path.to_s) do - sys_exec %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect'), :env => { "GEM_HOME" => system_gem_path.to_s } + sys_exec %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect'), env: { "GEM_HOME" => system_gem_path.to_s } end expect(out).to eq '["pkg"]' end diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb index 6dffd6d32b..298fee8867 100644 --- a/spec/bundler/runtime/inline_spec.rb +++ b/spec/bundler/runtime/inline_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundler/inline#gemfile" do s.write "lib/four.rb", "puts 'four'" end - build_lib "five", "1.0.0", :no_default => true do |s| + build_lib "five", "1.0.0", no_default: true do |s| s.write "lib/mofive.rb", "puts 'five'" end @@ -57,7 +57,7 @@ RSpec.describe "bundler/inline#gemfile" do expect(out).to eq("two") - script <<-RUBY, :raise_on_error => false + script <<-RUBY, raise_on_error: false gemfile do source "#{file_uri_for(gem_repo1)}" path "#{lib_path}" do @@ -80,7 +80,7 @@ RSpec.describe "bundler/inline#gemfile" do expect(out).to include("Rack's post install message") - script <<-RUBY, :artifice => "endpoint" + script <<-RUBY, artifice: "endpoint" gemfile(true) do source "https://notaserver.com" gem "activesupport", :require => true @@ -94,7 +94,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "lets me use my own ui object" do - script <<-RUBY, :artifice => "endpoint" + script <<-RUBY, artifice: "endpoint" require 'bundler' class MyBundlerUI < Bundler::UI::Shell def confirm(msg, newline = nil) @@ -113,7 +113,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "has an option for quiet installation" do - script <<-RUBY, :artifice => "endpoint" + script <<-RUBY, artifice: "endpoint" require 'bundler/inline' gemfile(true, :quiet => true) do @@ -126,7 +126,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "raises an exception if passed unknown arguments" do - script <<-RUBY, :raise_on_error => false + script <<-RUBY, raise_on_error: false gemfile(true, :arglebargle => true) do path "#{lib_path}" gem "two" @@ -431,7 +431,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "installs inline gems when frozen is set" do - script <<-RUBY, :env => { "BUNDLE_FROZEN" => "true" } + script <<-RUBY, env: { "BUNDLE_FROZEN" => "true" } gemfile do source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -444,7 +444,7 @@ RSpec.describe "bundler/inline#gemfile" do end it "installs inline gems when deployment is set" do - script <<-RUBY, :env => { "BUNDLE_DEPLOYMENT" => "true" } + script <<-RUBY, env: { "BUNDLE_DEPLOYMENT" => "true" } gemfile do source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -488,7 +488,7 @@ RSpec.describe "bundler/inline#gemfile" do context "when BUNDLE_PATH is set" do it "installs inline gems to the system path regardless" do - script <<-RUBY, :env => { "BUNDLE_PATH" => "./vendor/inline" } + script <<-RUBY, env: { "BUNDLE_PATH" => "./vendor/inline" } gemfile(true) do source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -576,7 +576,7 @@ RSpec.describe "bundler/inline#gemfile" do s.write "lib/foo.rb", foo_code end - script <<-RUBY, :dir => tmp("path_without_gemfile") + script <<-RUBY, dir: tmp("path_without_gemfile") gemfile do source "#{file_uri_for(gem_repo2)}" path "#{lib_path}" do @@ -592,12 +592,12 @@ RSpec.describe "bundler/inline#gemfile" do end it "when requiring fileutils after does not show redefinition warnings", :realworld do - dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", :raise_on_error => false + dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", raise_on_error: false skip "does not work if rubygems/dependency_installer loads fileutils, which happens until rubygems 3.2.0" unless dependency_installer_loads_fileutils.empty? Dir.mkdir tmp("path_without_gemfile") - default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", :raise_on_error => false + default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", raise_on_error: false skip "fileutils isn't a default gem" if default_fileutils_version.empty? realworld_system_gems "fileutils --version 1.4.1" @@ -609,7 +609,7 @@ RSpec.describe "bundler/inline#gemfile" do # on prerelease rubies, a required_rubygems_version constraint is added by RubyGems to the resolution, causing Molinillo to load the `set` gem realworld_system_gems "set --version 1.0.3" if Gem.ruby_version.prerelease? - script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + script <<-RUBY, dir: tmp("path_without_gemfile"), env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } require "bundler/inline" gemfile(true) do diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb index 4cbb52764b..1925e9bf2e 100644 --- a/spec/bundler/runtime/platform_spec.rb +++ b/spec/bundler/runtime/platform_spec.rb @@ -145,7 +145,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do #{Bundler::VERSION} L - bundle "install", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } expect(out).to include("Fetching nokogiri 1.11.1") expect(the_bundle).to include_gems "nokogiri 1.11.1" @@ -359,7 +359,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end simulate_platform "aarch64-linux-musl" do - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, :verbose => true + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, verbose: true source "https://gems.repo4" gem "nokogiri" G @@ -386,7 +386,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do end it "allows specifying only-ruby-platform on windows with gemspec dependency" do - build_lib("foo", "1.0", :path => bundled_app) do |s| + build_lib("foo", "1.0", path: bundled_app) do |s| s.add_dependency "rack" end @@ -427,7 +427,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do requires_platform_specific L - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo2)}" gem "requires_platform_specific" G diff --git a/spec/bundler/runtime/require_spec.rb b/spec/bundler/runtime/require_spec.rb index 61dbd303f7..76271a5593 100644 --- a/spec/bundler/runtime/require_spec.rb +++ b/spec/bundler/runtime/require_spec.rb @@ -21,7 +21,7 @@ RSpec.describe "Bundler.require" do s.write "lib/four.rb", "puts 'four'" end - build_lib "five", "1.0.0", :no_default => true do |s| + build_lib "five", "1.0.0", no_default: true do |s| s.write "lib/mofive.rb", "puts 'five'" end @@ -138,7 +138,7 @@ RSpec.describe "Bundler.require" do end G - run "Bundler.require", :raise_on_error => false + run "Bundler.require", raise_on_error: false expect(err).to match("error while trying to load the gem 'faulty'") expect(err).to match("Gem Internal Error Message") end @@ -187,7 +187,7 @@ RSpec.describe "Bundler.require" do end it "silently passes if the require fails" do - build_lib "bcrypt-ruby", "1.0.0", :no_default => true do |s| + build_lib "bcrypt-ruby", "1.0.0", no_default: true do |s| s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'" end gemfile <<-G @@ -323,7 +323,7 @@ RSpec.describe "Bundler.require" do describe "a gem with different requires for different envs" do before(:each) do - build_gem "multi_gem", :to_bundle => true do |s| + build_gem "multi_gem", to_bundle: true do |s| s.write "lib/one.rb", "puts 'ONE'" s.write "lib/two.rb", "puts 'TWO'" end @@ -366,7 +366,7 @@ RSpec.describe "Bundler.require" do describe "with busted gems" do it "should be busted" do - build_gem "busted_require", :to_bundle => true do |s| + build_gem "busted_require", to_bundle: true do |s| s.write "lib/busted_require.rb", "require 'no_such_file_omg'" end diff --git a/spec/bundler/runtime/requiring_spec.rb b/spec/bundler/runtime/requiring_spec.rb index 58e44febed..1f32269622 100644 --- a/spec/bundler/runtime/requiring_spec.rb +++ b/spec/bundler/runtime/requiring_spec.rb @@ -2,13 +2,13 @@ RSpec.describe "Requiring bundler" do it "takes care of requiring rubygems when entrypoint is bundler/setup" do - sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler/setup -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) }) + sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler/setup -e'puts true'", env: { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) }) expect(last_command.stdboth).to eq("true") end it "takes care of requiring rubygems when requiring just bundler" do - sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler -e'puts true'", :env => { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) }) + sys_exec("#{Gem.ruby} -I#{lib_dir} -rbundler -e'puts true'", env: { "RUBYOPT" => opt_add("--disable=gems", ENV["RUBYOPT"]) }) expect(last_command.stdboth).to eq("true") end diff --git a/spec/bundler/runtime/self_management_spec.rb b/spec/bundler/runtime/self_management_spec.rb index 3e49db4f32..2c835bc284 100644 --- a/spec/bundler/runtime/self_management_spec.rb +++ b/spec/bundler/runtime/self_management_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => true do +RSpec.describe "Self management", rubygems: ">= 3.3.0.dev", realworld: true do describe "auto switching" do let(:previous_minor) do "2.3.0" @@ -24,7 +24,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(previous_minor) bundle "config set --local path.system true" - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") # It uninstalls the older system bundler @@ -45,7 +45,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(previous_minor) bundle "config set --local path vendor/bundle" - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist @@ -67,7 +67,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(previous_minor) bundle "config set --local deployment true" - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(out).to include("Bundler #{Bundler::VERSION} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist @@ -100,7 +100,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(missing_minor) - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(err).to eq("Your lockfile is locked to a version of bundler (#{missing_minor}) that doesn't exist at https://rubygems.org/. Going on using #{Bundler::VERSION}") bundle "-v" @@ -111,7 +111,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(current_version) bundle "config set --local version #{previous_minor}" - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(out).to include("Bundler #{Bundler::VERSION} is running, but your configuration was #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.") bundle "-v" @@ -122,7 +122,7 @@ RSpec.describe "Self management", :rubygems => ">= 3.3.0.dev", :realworld => tru lockfile_bundled_with(previous_minor) bundle "config set version system" - bundle "install", :artifice => "vcr" + bundle "install", artifice: "vcr" expect(out).not_to match(/restarting using that version/) bundle "-v" diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index fde3a34787..39897a38d6 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -89,7 +89,7 @@ RSpec.describe "Bundler.setup" do end it "handles multiple non-additive invocations" do - ruby <<-RUBY, :raise_on_error => false + ruby <<-RUBY, raise_on_error: false require 'bundler' Bundler.setup(:default, :test) Bundler.setup(:default) @@ -213,7 +213,7 @@ RSpec.describe "Bundler.setup" do gem "rack" G - ruby <<-R, :raise_on_error => false + ruby <<-R, raise_on_error: false require 'bundler' Bundler.setup @@ -236,7 +236,7 @@ RSpec.describe "Bundler.setup" do gem "nosuchgem", "10.0" G - ruby <<-R, :raise_on_error => false + ruby <<-R, raise_on_error: false require 'bundler' Bundler.setup @@ -312,7 +312,7 @@ RSpec.describe "Bundler.setup" do gem "rack", "1.0.0" G - build_gem "rack", "1.0", :to_system => true do |s| + build_gem "rack", "1.0", to_system: true do |s| s.write "lib/rack.rb", "RACK = 'FAIL'" end @@ -372,7 +372,7 @@ RSpec.describe "Bundler.setup" do context "when the ruby stdlib is a substring of Gem.path" do it "does not reject the stdlib from $LOAD_PATH" do substring = "/" + $LOAD_PATH.find {|p| p.include?("vendor_ruby") }.split("/")[2] - run "puts 'worked!'", :env => { "GEM_PATH" => substring } + run "puts 'worked!'", env: { "GEM_PATH" => substring } expect(out).to eq("worked!") end end @@ -410,7 +410,7 @@ RSpec.describe "Bundler.setup" do end it "provides a useful exception when the git repo is not checked out yet" do - run "1", :raise_on_error => false + run "1", raise_on_error: false expect(err).to match(/the git source #{lib_path("rack-1.0.0")} is not yet checked out. Please run `bundle install`/i) end @@ -451,7 +451,7 @@ RSpec.describe "Bundler.setup" do end R - run "puts 'FAIL'", :raise_on_error => false + run "puts 'FAIL'", raise_on_error: false expect(err).not_to include "This is not the git you are looking for" end @@ -497,7 +497,7 @@ RSpec.describe "Bundler.setup" do bundle :install FileUtils.rm_rf(lib_path("local-rack")) - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path("local-rack").to_s)} does not exist/) end @@ -519,7 +519,7 @@ RSpec.describe "Bundler.setup" do gem "rack", :git => "#{lib_path("rack-0.8")}" G - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(err).to match(/because :branch is not specified in Gemfile/) end @@ -541,7 +541,7 @@ RSpec.describe "Bundler.setup" do gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "changed" G - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(err).to match(/is using branch main but Gemfile specifies changed/) end @@ -561,7 +561,7 @@ RSpec.describe "Bundler.setup" do G bundle %(config set local.rack #{lib_path("local-rack")}) - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(err).to match(/is using branch main but Gemfile specifies nonexistent/) end end @@ -580,7 +580,7 @@ RSpec.describe "Bundler.setup" do system_gems "activesupport-2.3.5" - expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => :default + expect(the_bundle).to include_gems "activesupport 2.3.2", groups: :default end it "remembers --without and does not bail on bare Bundler.setup" do @@ -603,7 +603,7 @@ RSpec.describe "Bundler.setup" do bundle "config set --local without development" path = bundled_app(File.join("vendor", "foo")) - build_lib "foo", :path => path + build_lib "foo", path: path install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -613,7 +613,7 @@ RSpec.describe "Bundler.setup" do FileUtils.rm_rf(path) - ruby "require 'bundler'; Bundler.setup", :env => { "DEBUG" => "1" } + ruby "require 'bundler'; Bundler.setup", env: { "DEBUG" => "1" } expect(out).to include("Assuming that source at `vendor/foo` has not changed since fetching its specs errored") expect(out).to include("Found no changes, using resolution from the lockfile") expect(err).to be_empty @@ -633,7 +633,7 @@ RSpec.describe "Bundler.setup" do gem "depends_on_bundler" G - ruby "require '#{system_gem_path("gems/bundler-9.99.9.beta1/lib/bundler.rb")}'; Bundler.setup", :env => { "DEBUG" => "1" } + ruby "require '#{system_gem_path("gems/bundler-9.99.9.beta1/lib/bundler.rb")}'; Bundler.setup", env: { "DEBUG" => "1" } expect(out).to include("Found no changes, using resolution from the lockfile") expect(out).not_to include("lockfile does not have all gems needed for the current platform") expect(err).to be_empty @@ -645,7 +645,7 @@ RSpec.describe "Bundler.setup" do gem "bundler" G - bundle "install --verbose", :env => { "BUNDLE_FROZEN" => "true" } + bundle "install --verbose", env: { "BUNDLE_FROZEN" => "true" } expect(err).to be_empty end @@ -656,7 +656,7 @@ RSpec.describe "Bundler.setup" do gem "actionpack" G - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "rack" G @@ -680,15 +680,15 @@ RSpec.describe "Bundler.setup" do end G - expect(the_bundle).not_to include_gems "activesupport 2.3.2", :groups => :rack - expect(the_bundle).to include_gems "rack 1.0.0", :groups => :rack + expect(the_bundle).not_to include_gems "activesupport 2.3.2", groups: :rack + expect(the_bundle).to include_gems "rack 1.0.0", groups: :rack end end # RubyGems returns loaded_from as a string it "has loaded_from as a string on all specs" do build_git "foo" - build_git "no-gemspec", :gemspec => false + build_git "no-gemspec", gemspec: false install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -907,7 +907,7 @@ end it "should not remove itself from the LOAD_PATH and require a different copy of 'bundler/setup'" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home } + ruby <<-R, env: { "GEM_PATH" => symlinked_gem_home } TracePoint.trace(:class) do |tp| if tp.path.include?("bundler") && !tp.path.start_with?("#{source_root}") puts "OMG. Defining a class from another bundler at \#{tp.path}:\#{tp.lineno}" @@ -947,7 +947,7 @@ end it "should resolve paths relative to the Gemfile" do path = bundled_app(File.join("vendor", "foo")) - build_lib "foo", :path => path + build_lib "foo", path: path # If the .gemspec exists, then Bundler handles the path differently. # See Source::Path.load_spec_files for details. @@ -958,7 +958,7 @@ end gem 'foo', '1.2.3', :path => 'vendor/foo' G - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent + run <<-R, env: { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, dir: bundled_app.parent require 'foo' R expect(err).to be_empty @@ -968,7 +968,7 @@ end relative_path = File.join("vendor", Dir.pwd.gsub(/^#{filesystem_root}/, "")) absolute_path = bundled_app(relative_path) FileUtils.mkdir_p(absolute_path) - build_lib "foo", :path => absolute_path + build_lib "foo", path: absolute_path # If the .gemspec exists, then Bundler handles the path differently. # See Source::Path.load_spec_files for details. @@ -981,7 +981,7 @@ end bundle :install - run <<-R, :env => { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, :dir => bundled_app.parent + run <<-R, env: { "BUNDLE_GEMFILE" => bundled_app_gemfile.to_s }, dir: bundled_app.parent require 'foo' R @@ -991,7 +991,7 @@ end describe "with git gems that don't have gemspecs" do before :each do - build_git "no_gemspec", :gemspec => false + build_git "no_gemspec", gemspec: false install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1081,7 +1081,7 @@ end describe "with a gemspec that requires other files" do before :each do - build_git "bar", :gemspec => false do |s| + build_git "bar", gemspec: false do |s| s.write "lib/bar/version.rb", %(BAR_VERSION = '1.0') s.write "bar.gemspec", <<-G require_relative 'lib/bar/version' @@ -1111,10 +1111,10 @@ end it "error intelligently if the gemspec has a LoadError" do skip "whitespace issue?" if Gem.win_platform? - ref = update_git "bar", :gemspec => false do |s| + ref = update_git "bar", gemspec: false do |s| s.write "bar.gemspec", "require 'foobarbaz'" end.ref_for("HEAD") - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err.lines.map(&:chomp)).to include( a_string_starting_with("[!] There was an error while loading `bar.gemspec`:"), @@ -1281,7 +1281,7 @@ end describe "with gemified standard libraries" do it "does not load Digest", :ruby_repo do - build_git "bar", :gemspec => false do |s| + build_git "bar", gemspec: false do |s| s.write "lib/bar/version.rb", %(BAR_VERSION = '1.0') s.write "bar.gemspec", <<-G require_relative 'lib/bar/version' @@ -1384,14 +1384,14 @@ end it "activates no gems with -rbundler/setup" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" } + ruby code, env: { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" } expect(out).to eq("{}") end it "activates no gems with bundle exec" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" create_file("script.rb", code) - bundle "exec ruby ./script.rb", :env => { "RUBYOPT" => activation_warning_hack_rubyopt } + bundle "exec ruby ./script.rb", env: { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") end @@ -1401,7 +1401,7 @@ end install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}") FileUtils.chmod(0o777, bundled_app("script.rb")) - bundle "exec ./script.rb", :artifice => nil, :env => { "RUBYOPT" => activation_warning_hack_rubyopt } + bundle "exec ./script.rb", artifice: nil, env: { "RUBYOPT" => activation_warning_hack_rubyopt } expect(out).to eq("{}") end @@ -1410,7 +1410,7 @@ end build_gem "net-http-pipeline", "1.0.1" end - system_gems "net-http-pipeline-1.0.1", :gem_repo => gem_repo4 + system_gems "net-http-pipeline-1.0.1", gem_repo: gem_repo4 gemfile <<-G source "#{file_uri_for(gem_repo4)}" @@ -1439,7 +1439,7 @@ end gem "#{g}", "999999" G - expect(the_bundle).to include_gem("#{g} 999999", :env => { "RUBYOPT" => activation_warning_hack_rubyopt }) + expect(the_bundle).to include_gem("#{g} 999999", env: { "RUBYOPT" => activation_warning_hack_rubyopt }) end it "activates older versions of #{g}", :ruby_repo do @@ -1454,14 +1454,14 @@ end gem "#{g}", "0.0.0.a" G - expect(the_bundle).to include_gem("#{g} 0.0.0.a", :env => { "RUBYOPT" => activation_warning_hack_rubyopt }) + expect(the_bundle).to include_gem("#{g} 0.0.0.a", env: { "RUBYOPT" => activation_warning_hack_rubyopt }) end end end end describe "after setup" do - it "allows calling #gem on random objects", :bundler => "< 3" do + it "allows calling #gem on random objects", bundler: "< 3" do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -1476,13 +1476,13 @@ end expect(out).to eq("rack-1.0.0") end - it "keeps Kernel#gem private", :bundler => "3" do + it "keeps Kernel#gem private", bundler: "3" do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" G - ruby <<-RUBY, :raise_on_error => false + ruby <<-RUBY, raise_on_error: false require "bundler/setup" Object.new.gem "rack" puts "FAIL" @@ -1498,7 +1498,7 @@ end gem "rack" G - ruby <<-RUBY, :raise_on_error => false + ruby <<-RUBY, raise_on_error: false require "bundler/setup" Object.new.require "rack" puts "FAIL" @@ -1515,7 +1515,7 @@ end gem "rack", :group => :test G - ruby <<-RUBY, :raise_on_error => false + ruby <<-RUBY, raise_on_error: false require "bundler/setup" Bundler.require(:test).select! {|d| (d.groups & [:test]).any? } puts Bundler.definition.specs.map(&:name).join(", ") @@ -1535,7 +1535,7 @@ end end end - system_gems "json-999.999.999", :gem_repo => gem_repo2 + system_gems "json-999.999.999", gem_repo: gem_repo2 install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" ruby <<-RUBY @@ -1548,7 +1548,7 @@ end end end - it "does not undo the Kernel.require decorations", :rubygems => ">= 3.4.6" do + it "does not undo the Kernel.require decorations", rubygems: ">= 3.4.6" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" script = bundled_app("bin/script") create_file(script, <<~RUBY) @@ -1569,7 +1569,7 @@ end require "foo" RUBY - sys_exec "#{Gem.ruby} #{script}", :raise_on_error => false + sys_exec "#{Gem.ruby} #{script}", raise_on_error: false expect(out).to include("requiring foo used the monkeypatch") end end diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb index fa6140713d..84b198cfb6 100644 --- a/spec/bundler/runtime/with_unbundled_env_spec.rb +++ b/spec/bundler/runtime/with_unbundled_env_spec.rb @@ -130,7 +130,7 @@ RSpec.describe "Bundler.with_env helpers" do it_behaves_like "an unbundling helper" end - describe "Bundler.clean_env", :bundler => 2 do + describe "Bundler.clean_env", bundler: 2 do let(:modified_env) { "Bundler.clean_env" } it_behaves_like "an unbundling helper" @@ -152,7 +152,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.with_clean_env", :bundler => 2 do + describe "Bundler.with_clean_env", bundler: 2 do it "should set ENV to unbundled_env in the block" do expected = Bundler.unbundled_env @@ -203,7 +203,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_system", :bundler => 2 do + describe "Bundler.clean_system", bundler: 2 do before do create_file("source.rb", <<-'RUBY') Bundler.ui.silence { Bundler.clean_system("ruby", "-e", "exit(42) unless ENV['BUNDLE_FOO'] == 'bar'") } @@ -254,7 +254,7 @@ RSpec.describe "Bundler.with_env helpers" do end end - describe "Bundler.clean_exec", :bundler => 2 do + describe "Bundler.clean_exec", bundler: 2 do before do create_file("source.rb", <<-'RUBY') Process.fork do |