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 | |
parent | 9d696aa20461d94c2d32e1e474bd036ade20c94d (diff) |
[rubygems/rubygems] Use modern hashes consistently
https://github.com/rubygems/rubygems/commit/bb66253f2c
Diffstat (limited to 'spec/bundler')
137 files changed, 1964 insertions, 1964 deletions
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb index f870007f5a..1ccdbee316 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb @@ -88,7 +88,7 @@ RSpec.describe Bundler do end end - context "with correct YAML file", :if => defined?(Encoding) do + context "with correct YAML file", if: defined?(Encoding) do it "can load a gemspec with unicode characters with default ruby encoding" do # spec_helper forces the external encoding to UTF-8 but that's not the # default until Ruby 2.0 @@ -139,7 +139,7 @@ RSpec.describe Bundler do end GEMSPEC end - expect(Bundler.rubygems).to receive(:validate).with have_attributes(:name => "validated") + expect(Bundler.rubygems).to receive(:validate).with have_attributes(name: "validated") subject end end diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb index 7acdc496e7..d3aa58cc29 100644 --- a/spec/bundler/bundler/cli_spec.rb +++ b/spec/bundler/bundler/cli_spec.rb @@ -5,12 +5,12 @@ require "json" RSpec.describe "bundle executable" do it "returns non-zero exit status when passed unrecognized options" do - bundle "--invalid_argument", :raise_on_error => false + bundle "--invalid_argument", raise_on_error: false expect(exitstatus).to_not be_zero end it "returns non-zero exit status when passed unrecognized task" do - bundle "unrecognized-task", :raise_on_error => false + bundle "unrecognized-task", raise_on_error: false expect(exitstatus).to_not be_zero end @@ -88,7 +88,7 @@ RSpec.describe "bundle executable" do end context "with no arguments" do - it "prints a concise help message", :bundler => "3" do + it "prints a concise help message", bundler: "3" do bundle "" expect(err).to be_empty expect(out).to include("Bundler version #{Bundler::VERSION}"). @@ -106,7 +106,7 @@ RSpec.describe "bundle executable" do gem 'rack' G - bundle :install, :env => { "BUNDLE_GEMFILE" => "" } + bundle :install, env: { "BUNDLE_GEMFILE" => "" } expect(the_bundle).to include_gems "rack 1.0.0" end @@ -115,17 +115,17 @@ RSpec.describe "bundle executable" do context "with --verbose" do it "prints the running command" do gemfile "source \"#{file_uri_for(gem_repo1)}\"" - bundle "info bundler", :verbose => true + bundle "info bundler", verbose: true expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :verbose => true + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", verbose: true expect(out).to start_with("Running `bundle install --verbose` with bundler #{Bundler::VERSION}") end end @@ -134,7 +134,7 @@ RSpec.describe "bundle executable" do let(:run_command) do bundle "install" - bundle "outdated #{flags}", :raise_on_error => false + bundle "outdated #{flags}", raise_on_error: false end before do @@ -199,7 +199,7 @@ RSpec.describe "bundle executable" do describe "printing the outdated warning" do shared_examples_for "no warning" do it "prints no warning" do - bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false + bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false expect(last_command.stdboth).to eq("Could not find command \"fail\".") end end @@ -234,7 +234,7 @@ RSpec.describe "bundle executable" do context "when the latest version is greater than the current version" do let(:latest_version) { "222.0" } it "prints the version warning" do - bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false + bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false expect(err).to start_with(<<-EOS.strip) The latest bundler is #{latest_version}, but you are currently running #{bundler_version}. To update to the most recent version, run `bundle update --bundler` @@ -242,16 +242,16 @@ To update to the most recent version, run `bundle update --bundler` end context "and disable_version_check is set" do - before { bundle "config set disable_version_check true", :env => { "BUNDLER_VERSION" => bundler_version } } + before { bundle "config set disable_version_check true", env: { "BUNDLER_VERSION" => bundler_version } } include_examples "no warning" end context "running a parseable command" do it "prints no warning" do - bundle "config get --parseable foo", :env => { "BUNDLER_VERSION" => bundler_version } + bundle "config get --parseable foo", env: { "BUNDLER_VERSION" => bundler_version } expect(last_command.stdboth).to eq "" - bundle "platform --ruby", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false + bundle "platform --ruby", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false expect(last_command.stdboth).to eq "Could not locate Gemfile" end end @@ -259,7 +259,7 @@ To update to the most recent version, run `bundle update --bundler` context "and is a pre-release" do let(:latest_version) { "222.0.0.pre.4" } it "prints the version warning" do - bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false + bundle "fail", env: { "BUNDLER_VERSION" => bundler_version }, raise_on_error: false expect(err).to start_with(<<-EOS.strip) The latest bundler is #{latest_version}, but you are currently running #{bundler_version}. To update to the most recent version, run `bundle update --bundler` @@ -271,12 +271,12 @@ To update to the most recent version, run `bundle update --bundler` end RSpec.describe "bundler executable" do - it "shows the bundler version just as the `bundle` executable does", :bundler => "< 3" do + it "shows the bundler version just as the `bundle` executable does", bundler: "< 3" do bundler "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "shows the bundler version just as the `bundle` executable does", :bundler => "3" do + it "shows the bundler version just as the `bundle` executable does", bundler: "3" do bundler "--version" expect(out).to eq(Bundler::VERSION) end diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb index 430e536ac0..1f11dffac9 100644 --- a/spec/bundler/bundler/compact_index_client/updater_spec.rb +++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do let(:remote_path) { double(:remote_path) } let(:full_body) { "abc123" } - let(:response) { double(:response, :body => full_body, :is_a? => false) } + let(:response) { double(:response, body: full_body, is_a?: false) } let(:digest) { Digest::SHA256.base64digest(full_body) } context "when the local path does not exist" do @@ -105,7 +105,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do allow(response).to receive(:is_a?).with(Net::HTTPPartialContent) { true } expect(fetcher).to receive(:call).once.with(remote_path, headers).and_return(response) - full_response = double(:full_response, :body => full_body, :is_a? => false) + full_response = double(:full_response, body: full_body, is_a?: false) allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" } allow(full_response).to receive(:[]).with("ETag") { "NewEtag" } expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response) @@ -178,7 +178,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do response end - full_response = double(:full_response, :body => full_body, :is_a? => false) + full_response = double(:full_response, body: full_body, is_a?: false) allow(full_response).to receive(:[]).with("Repr-Digest") { "sha-256=:#{digest}:" } allow(full_response).to receive(:[]).with("ETag") { "NewEtag" } expect(fetcher).to receive(:call).once.with(remote_path, { "If-None-Match" => "LocalEtag" }).and_return(full_response) @@ -193,7 +193,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do context "when the ETag header is missing" do # Regression test for https://github.com/rubygems/bundler/issues/5463 - let(:response) { double(:response, :body => full_body) } + let(:response) { double(:response, body: full_body) } it "treats the response as an update" do allow(response).to receive(:[]).with("Repr-Digest") { nil } @@ -206,7 +206,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do end context "when the download is corrupt" do - let(:response) { double(:response, :body => "") } + let(:response) { double(:response, body: "") } it "raises HTTPError" do expect(fetcher).to receive(:call).and_raise(Zlib::GzipFile::Error) @@ -218,7 +218,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do end context "when receiving non UTF-8 data and default internal encoding set to ASCII" do - let(:response) { double(:response, :body => "\x8B".b) } + let(:response) { double(:response, body: "\x8B".b) } it "works just fine" do old_verbose = $VERBOSE diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb index 367cb7bcff..2e3c1584b1 100644 --- a/spec/bundler/bundler/definition_spec.rb +++ b/spec/bundler/bundler/definition_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Bundler::Definition do before do allow(Bundler).to receive(:settings) { Bundler::Settings.new(".") } allow(Bundler::SharedHelpers).to receive(:find_gemfile) { Pathname.new("Gemfile") } - allow(Bundler).to receive(:ui) { double("UI", :info => "", :debug => "") } + allow(Bundler).to receive(:ui) { double("UI", info: "", debug: "") } end context "when it's not possible to write to the file" do subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) } @@ -45,14 +45,14 @@ RSpec.describe Bundler::Definition do describe "detects changes" do it "for a path gem with changes" do - build_lib "foo", "1.0", :path => lib_path("foo") + build_lib "foo", "1.0", path: lib_path("foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "foo", :path => "#{lib_path("foo")}" G - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "1.0" end @@ -61,7 +61,7 @@ RSpec.describe Bundler::Definition do c.checksum gem_repo1, "rack", "1.0.0" end - bundle :install, :env => { "DEBUG" => "1" } + bundle :install, env: { "DEBUG" => "1" } expect(out).to match(/re-resolving dependencies/) expect(lockfile).to eq <<~G @@ -100,13 +100,13 @@ RSpec.describe Bundler::Definition do bundle "lock --add-platform java" - bundle "update ffi", :env => { "DEBUG" => "1" } + bundle "update ffi", env: { "DEBUG" => "1" } expect(out).to match(/because bundler is unlocking gems: \(ffi\)/) end it "for a path gem with deps and no changes" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "1.0" s.add_development_dependency "net-ssh", "1.0" end @@ -121,7 +121,7 @@ RSpec.describe Bundler::Definition do gem "foo", :path => "#{lib_path("foo")}" G - bundle :check, :env => { "DEBUG" => "1" } + bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(lockfile).to eq <<~G @@ -158,7 +158,7 @@ RSpec.describe Bundler::Definition do G bundle "lock --add-platform java" - bundle :check, :env => { "DEBUG" => "1" } + bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(lockfile).to eq <<~G @@ -188,7 +188,7 @@ RSpec.describe Bundler::Definition do gem "foo" G - bundle :check, :env => { "DEBUG" => "1" } + bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(lockfile).to eq <<~G @@ -278,7 +278,7 @@ RSpec.describe Bundler::Definition do bundled_app_lock, updated_deps_in_gemfile, source_list, - :gems => ["shared_owner_a"], :conservative => true + gems: ["shared_owner_a"], conservative: true ) locked = definition.send(:converge_locked_specs).map(&:name) expect(locked).to eq %w[isolated_dep isolated_owner shared_dep shared_owner_b] diff --git a/spec/bundler/bundler/dependency_spec.rb b/spec/bundler/bundler/dependency_spec.rb index 1ef511f1aa..52a85f45b4 100644 --- a/spec/bundler/bundler/dependency_spec.rb +++ b/spec/bundler/bundler/dependency_spec.rb @@ -40,116 +40,116 @@ RSpec.describe Bundler::Dependency do # rubocop:disable Naming/VariableNumber let(:platforms) do - { :ruby => Gem::Platform::RUBY, - :ruby_18 => Gem::Platform::RUBY, - :ruby_19 => Gem::Platform::RUBY, - :ruby_20 => Gem::Platform::RUBY, - :ruby_21 => Gem::Platform::RUBY, - :ruby_22 => Gem::Platform::RUBY, - :ruby_23 => Gem::Platform::RUBY, - :ruby_24 => Gem::Platform::RUBY, - :ruby_25 => Gem::Platform::RUBY, - :ruby_26 => Gem::Platform::RUBY, - :ruby_27 => Gem::Platform::RUBY, - :ruby_30 => Gem::Platform::RUBY, - :ruby_31 => Gem::Platform::RUBY, - :ruby_32 => Gem::Platform::RUBY, - :ruby_33 => Gem::Platform::RUBY, - :mri => Gem::Platform::RUBY, - :mri_18 => Gem::Platform::RUBY, - :mri_19 => Gem::Platform::RUBY, - :mri_20 => Gem::Platform::RUBY, - :mri_21 => Gem::Platform::RUBY, - :mri_22 => Gem::Platform::RUBY, - :mri_23 => Gem::Platform::RUBY, - :mri_24 => Gem::Platform::RUBY, - :mri_25 => Gem::Platform::RUBY, - :mri_26 => Gem::Platform::RUBY, - :mri_27 => Gem::Platform::RUBY, - :mri_30 => Gem::Platform::RUBY, - :mri_31 => Gem::Platform::RUBY, - :mri_32 => Gem::Platform::RUBY, - :mri_33 => Gem::Platform::RUBY, - :rbx => Gem::Platform::RUBY, - :truffleruby => Gem::Platform::RUBY, - :jruby => Gem::Platform::JAVA, - :jruby_18 => Gem::Platform::JAVA, - :jruby_19 => Gem::Platform::JAVA, - :windows => Gem::Platform::WINDOWS, - :windows_18 => Gem::Platform::WINDOWS, - :windows_19 => Gem::Platform::WINDOWS, - :windows_20 => Gem::Platform::WINDOWS, - :windows_21 => Gem::Platform::WINDOWS, - :windows_22 => Gem::Platform::WINDOWS, - :windows_23 => Gem::Platform::WINDOWS, - :windows_24 => Gem::Platform::WINDOWS, - :windows_25 => Gem::Platform::WINDOWS, - :windows_26 => Gem::Platform::WINDOWS, - :windows_27 => Gem::Platform::WINDOWS, - :windows_30 => Gem::Platform::WINDOWS, - :windows_31 => Gem::Platform::WINDOWS, - :windows_32 => Gem::Platform::WINDOWS, - :windows_33 => Gem::Platform::WINDOWS } + { ruby: Gem::Platform::RUBY, + ruby_18: Gem::Platform::RUBY, + ruby_19: Gem::Platform::RUBY, + ruby_20: Gem::Platform::RUBY, + ruby_21: Gem::Platform::RUBY, + ruby_22: Gem::Platform::RUBY, + ruby_23: Gem::Platform::RUBY, + ruby_24: Gem::Platform::RUBY, + ruby_25: Gem::Platform::RUBY, + ruby_26: Gem::Platform::RUBY, + ruby_27: Gem::Platform::RUBY, + ruby_30: Gem::Platform::RUBY, + ruby_31: Gem::Platform::RUBY, + ruby_32: Gem::Platform::RUBY, + ruby_33: Gem::Platform::RUBY, + mri: Gem::Platform::RUBY, + mri_18: Gem::Platform::RUBY, + mri_19: Gem::Platform::RUBY, + mri_20: Gem::Platform::RUBY, + mri_21: Gem::Platform::RUBY, + mri_22: Gem::Platform::RUBY, + mri_23: Gem::Platform::RUBY, + mri_24: Gem::Platform::RUBY, + mri_25: Gem::Platform::RUBY, + mri_26: Gem::Platform::RUBY, + mri_27: Gem::Platform::RUBY, + mri_30: Gem::Platform::RUBY, + mri_31: Gem::Platform::RUBY, + mri_32: Gem::Platform::RUBY, + mri_33: Gem::Platform::RUBY, + rbx: Gem::Platform::RUBY, + truffleruby: Gem::Platform::RUBY, + jruby: Gem::Platform::JAVA, + jruby_18: Gem::Platform::JAVA, + jruby_19: Gem::Platform::JAVA, + windows: Gem::Platform::WINDOWS, + windows_18: Gem::Platform::WINDOWS, + windows_19: Gem::Platform::WINDOWS, + windows_20: Gem::Platform::WINDOWS, + windows_21: Gem::Platform::WINDOWS, + windows_22: Gem::Platform::WINDOWS, + windows_23: Gem::Platform::WINDOWS, + windows_24: Gem::Platform::WINDOWS, + windows_25: Gem::Platform::WINDOWS, + windows_26: Gem::Platform::WINDOWS, + windows_27: Gem::Platform::WINDOWS, + windows_30: Gem::Platform::WINDOWS, + windows_31: Gem::Platform::WINDOWS, + windows_32: Gem::Platform::WINDOWS, + windows_33: Gem::Platform::WINDOWS } end let(:deprecated) do - { :mswin => Gem::Platform::MSWIN, - :mswin_18 => Gem::Platform::MSWIN, - :mswin_19 => Gem::Platform::MSWIN, - :mswin_20 => Gem::Platform::MSWIN, - :mswin_21 => Gem::Platform::MSWIN, - :mswin_22 => Gem::Platform::MSWIN, - :mswin_23 => Gem::Platform::MSWIN, - :mswin_24 => Gem::Platform::MSWIN, - :mswin_25 => Gem::Platform::MSWIN, - :mswin_26 => Gem::Platform::MSWIN, - :mswin_27 => Gem::Platform::MSWIN, - :mswin_30 => Gem::Platform::MSWIN, - :mswin_31 => Gem::Platform::MSWIN, - :mswin_32 => Gem::Platform::MSWIN, - :mswin_33 => Gem::Platform::MSWIN, - :mswin64 => Gem::Platform::MSWIN64, - :mswin64_19 => Gem::Platform::MSWIN64, - :mswin64_20 => Gem::Platform::MSWIN64, - :mswin64_21 => Gem::Platform::MSWIN64, - :mswin64_22 => Gem::Platform::MSWIN64, - :mswin64_23 => Gem::Platform::MSWIN64, - :mswin64_24 => Gem::Platform::MSWIN64, - :mswin64_25 => Gem::Platform::MSWIN64, - :mswin64_26 => Gem::Platform::MSWIN64, - :mswin64_27 => Gem::Platform::MSWIN64, - :mswin64_30 => Gem::Platform::MSWIN64, - :mswin64_31 => Gem::Platform::MSWIN64, - :mswin64_32 => Gem::Platform::MSWIN64, - :mswin64_33 => Gem::Platform::MSWIN64, - :mingw => Gem::Platform::MINGW, - :mingw_18 => Gem::Platform::MINGW, - :mingw_19 => Gem::Platform::MINGW, - :mingw_20 => Gem::Platform::MINGW, - :mingw_21 => Gem::Platform::MINGW, - :mingw_22 => Gem::Platform::MINGW, - :mingw_23 => Gem::Platform::MINGW, - :mingw_24 => Gem::Platform::MINGW, - :mingw_25 => Gem::Platform::MINGW, - :mingw_26 => Gem::Platform::MINGW, - :mingw_27 => Gem::Platform::MINGW, - :mingw_30 => Gem::Platform::MINGW, - :mingw_31 => Gem::Platform::MINGW, - :mingw_32 => Gem::Platform::MINGW, - :mingw_33 => Gem::Platform::MINGW, - :x64_mingw => Gem::Platform::X64_MINGW, - :x64_mingw_20 => Gem::Platform::X64_MINGW, - :x64_mingw_21 => Gem::Platform::X64_MINGW, - :x64_mingw_22 => Gem::Platform::X64_MINGW, - :x64_mingw_23 => Gem::Platform::X64_MINGW, - :x64_mingw_24 => Gem::Platform::X64_MINGW, - :x64_mingw_25 => Gem::Platform::X64_MINGW, - :x64_mingw_26 => Gem::Platform::X64_MINGW, - :x64_mingw_27 => Gem::Platform::X64_MINGW, - :x64_mingw_30 => Gem::Platform::X64_MINGW, - :x64_mingw_31 => Gem::Platform::X64_MINGW, - :x64_mingw_32 => Gem::Platform::X64_MINGW, - :x64_mingw_33 => Gem::Platform::X64_MINGW } + { mswin: Gem::Platform::MSWIN, + mswin_18: Gem::Platform::MSWIN, + mswin_19: Gem::Platform::MSWIN, + mswin_20: Gem::Platform::MSWIN, + mswin_21: Gem::Platform::MSWIN, + mswin_22: Gem::Platform::MSWIN, + mswin_23: Gem::Platform::MSWIN, + mswin_24: Gem::Platform::MSWIN, + mswin_25: Gem::Platform::MSWIN, + mswin_26: Gem::Platform::MSWIN, + mswin_27: Gem::Platform::MSWIN, + mswin_30: Gem::Platform::MSWIN, + mswin_31: Gem::Platform::MSWIN, + mswin_32: Gem::Platform::MSWIN, + mswin_33: Gem::Platform::MSWIN, + mswin64: Gem::Platform::MSWIN64, + mswin64_19: Gem::Platform::MSWIN64, + mswin64_20: Gem::Platform::MSWIN64, + mswin64_21: Gem::Platform::MSWIN64, + mswin64_22: Gem::Platform::MSWIN64, + mswin64_23: Gem::Platform::MSWIN64, + mswin64_24: Gem::Platform::MSWIN64, + mswin64_25: Gem::Platform::MSWIN64, + mswin64_26: Gem::Platform::MSWIN64, + mswin64_27: Gem::Platform::MSWIN64, + mswin64_30: Gem::Platform::MSWIN64, + mswin64_31: Gem::Platform::MSWIN64, + mswin64_32: Gem::Platform::MSWIN64, + mswin64_33: Gem::Platform::MSWIN64, + mingw: Gem::Platform::MINGW, + mingw_18: Gem::Platform::MINGW, + mingw_19: Gem::Platform::MINGW, + mingw_20: Gem::Platform::MINGW, + mingw_21: Gem::Platform::MINGW, + mingw_22: Gem::Platform::MINGW, + mingw_23: Gem::Platform::MINGW, + mingw_24: Gem::Platform::MINGW, + mingw_25: Gem::Platform::MINGW, + mingw_26: Gem::Platform::MINGW, + mingw_27: Gem::Platform::MINGW, + mingw_30: Gem::Platform::MINGW, + mingw_31: Gem::Platform::MINGW, + mingw_32: Gem::Platform::MINGW, + mingw_33: Gem::Platform::MINGW, + x64_mingw: Gem::Platform::X64_MINGW, + x64_mingw_20: Gem::Platform::X64_MINGW, + x64_mingw_21: Gem::Platform::X64_MINGW, + x64_mingw_22: Gem::Platform::X64_MINGW, + x64_mingw_23: Gem::Platform::X64_MINGW, + x64_mingw_24: Gem::Platform::X64_MINGW, + x64_mingw_25: Gem::Platform::X64_MINGW, + x64_mingw_26: Gem::Platform::X64_MINGW, + x64_mingw_27: Gem::Platform::X64_MINGW, + x64_mingw_30: Gem::Platform::X64_MINGW, + x64_mingw_31: Gem::Platform::X64_MINGW, + x64_mingw_32: Gem::Platform::X64_MINGW, + x64_mingw_33: Gem::Platform::X64_MINGW } end # rubocop:enable Naming/VariableNumber diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb index 8b5bf930f2..99a8c3ad67 100644 --- a/spec/bundler/bundler/dsl_spec.rb +++ b/spec/bundler/bundler/dsl_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Bundler::Dsl do it "registers custom hosts" do subject.git_source(:example) {|repo_name| "[email protected]:#{repo_name}.git" } subject.git_source(:foobar) {|repo_name| "[email protected]:#{repo_name}.git" } - subject.gem("dobry-pies", :example => "strzalek/dobry-pies") + subject.gem("dobry-pies", example: "strzalek/dobry-pies") example_uri = "[email protected]:strzalek/dobry-pies.git" expect(subject.dependencies.first.source.uri).to eq(example_uri) end @@ -26,7 +26,7 @@ RSpec.describe Bundler::Dsl do end it "converts :github PR to URI using https" do - subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5") + subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5") github_uri = "https://github.com/indirect/sparks.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) expect(subject.dependencies.first.source.ref).to eq("refs/pull/5/head") @@ -34,21 +34,21 @@ RSpec.describe Bundler::Dsl do it "rejects :github PR URI with a branch, ref or tag" do expect do - subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :branch => "foo") + subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", branch: "foo") end.to raise_error( Bundler::GemfileError, %(The :branch option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), ) expect do - subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :ref => "foo") + subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", ref: "foo") end.to raise_error( Bundler::GemfileError, %(The :ref option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), ) expect do - subject.gem("sparks", :github => "https://github.com/indirect/sparks/pull/5", :tag => "foo") + subject.gem("sparks", github: "https://github.com/indirect/sparks/pull/5", tag: "foo") end.to raise_error( Bundler::GemfileError, %(The :tag option can't be used with `github: "https://github.com/indirect/sparks/pull/5"`), @@ -57,46 +57,46 @@ RSpec.describe Bundler::Dsl do it "rejects :github with :git" do expect do - subject.gem("sparks", :github => "indirect/sparks", :git => "https://github.com/indirect/sparks.git") + subject.gem("sparks", github: "indirect/sparks", git: "https://github.com/indirect/sparks.git") end.to raise_error( Bundler::GemfileError, %(The :git option can't be used with `github: "indirect/sparks"`), ) end - context "default hosts", :bundler => "< 3" do + context "default hosts", bundler: "< 3" do it "converts :github to URI using https" do - subject.gem("sparks", :github => "indirect/sparks") + subject.gem("sparks", github: "indirect/sparks") github_uri = "https://github.com/indirect/sparks.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "converts :github shortcut to URI using https" do - subject.gem("sparks", :github => "rails") + subject.gem("sparks", github: "rails") github_uri = "https://github.com/rails/rails.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "converts numeric :gist to :git" do - subject.gem("not-really-a-gem", :gist => 2_859_988) + subject.gem("not-really-a-gem", gist: 2_859_988) github_uri = "https://gist.github.com/2859988.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "converts :gist to :git" do - subject.gem("not-really-a-gem", :gist => "2859988") + subject.gem("not-really-a-gem", gist: "2859988") github_uri = "https://gist.github.com/2859988.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "converts :bitbucket to :git" do - subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") + subject.gem("not-really-a-gem", bitbucket: "mcorp/flatlab-rails") bitbucket_uri = "https://[email protected]/mcorp/flatlab-rails.git" expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri) end it "converts 'mcorp' to 'mcorp/mcorp'" do - subject.gem("not-really-a-gem", :bitbucket => "mcorp") + subject.gem("not-really-a-gem", bitbucket: "mcorp") bitbucket_uri = "https://[email protected]/mcorp/mcorp.git" expect(subject.dependencies.first.source.uri).to eq(bitbucket_uri) end @@ -142,18 +142,18 @@ RSpec.describe Bundler::Dsl do :ruby_30, :ruby_31, :ruby_32, :ruby_33, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, :mri_27, :mri_30, :mri_31, :mri_32, :mri_33, :jruby, :rbx, :truffleruby].each do |platform| it "allows #{platform} as a valid platform" do - subject.gem("foo", :platform => platform) + subject.gem("foo", platform: platform) end end # rubocop:enable Naming/VariableNumber it "allows platforms matching the running Ruby version" do platform = "ruby_#{RbConfig::CONFIG["MAJOR"]}#{RbConfig::CONFIG["MINOR"]}" - subject.gem("foo", :platform => platform) + subject.gem("foo", platform: platform) end it "rejects invalid platforms" do - expect { subject.gem("foo", :platform => :bogus) }. + expect { subject.gem("foo", platform: :bogus) }. to raise_error(Bundler::GemfileError, /is not a valid platform/) end @@ -203,19 +203,19 @@ RSpec.describe Bundler::Dsl do end it "rejects branch option on non-git gems" do - expect { subject.gem("foo", :branch => "test") }. + expect { subject.gem("foo", branch: "test") }. to raise_error(Bundler::GemfileError, /The `branch` option for `gem 'foo'` is not allowed. Only gems with a git source can specify a branch/) end it "allows specifying a branch on git gems" do - subject.gem("foo", :branch => "test", :git => "http://mytestrepo") + subject.gem("foo", branch: "test", git: "http://mytestrepo") dep = subject.dependencies.last expect(dep.name).to eq "foo" end it "allows specifying a branch on git gems with a git_source" do subject.git_source(:test_source) {|n| "https://github.com/#{n}" } - subject.gem("foo", :branch => "test", :test_source => "bundler/bundler") + subject.gem("foo", branch: "test", test_source: "bundler/bundler") dep = subject.dependencies.last expect(dep.name).to eq "foo" end @@ -280,7 +280,7 @@ RSpec.describe Bundler::Dsl do allow(Bundler).to receive(:default_gemfile).and_return(Pathname.new("./Gemfile")) subject.source("https://other-source.org") do - subject.gem("dobry-pies", :path => "foo") + subject.gem("dobry-pies", path: "foo") subject.gem("foo") end @@ -292,7 +292,7 @@ RSpec.describe Bundler::Dsl do describe "#check_primary_source_safety" do context "when a global source is not defined implicitly" do it "will raise a major deprecation warning" do - not_a_global_source = double("not-a-global-source", :no_remotes? => true) + not_a_global_source = double("not-a-global-source", no_remotes?: true) allow(Bundler::Source::Rubygems).to receive(:new).and_return(not_a_global_source) warning = "This Gemfile does not include an explicit global source. " \ diff --git a/spec/bundler/bundler/endpoint_specification_spec.rb b/spec/bundler/bundler/endpoint_specification_spec.rb index 7dd6925007..e7e10730cf 100644 --- a/spec/bundler/bundler/endpoint_specification_spec.rb +++ b/spec/bundler/bundler/endpoint_specification_spec.rb @@ -60,21 +60,21 @@ RSpec.describe Bundler::EndpointSpecification do it "should return the remote spec value when not set on endpoint specification and remote spec has one" do remote_value = "remote_value" - remote_spec = double(:remote_spec, :required_ruby_version => remote_value, :required_rubygems_version => nil) + remote_spec = double(:remote_spec, required_ruby_version: remote_value, required_rubygems_version: nil) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) expect(spec.required_ruby_version). eql?(remote_value) end it "should use the default Gem Requirement value when not set on endpoint specification and not set on remote spec" do - remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil) + remote_spec = double(:remote_spec, required_ruby_version: nil, required_rubygems_version: nil) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) expect(spec.required_ruby_version). eql?(Gem::Requirement.default) end end it "supports equality comparison" do - remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil) + remote_spec = double(:remote_spec, required_ruby_version: nil, required_rubygems_version: nil) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) other_spec = described_class.new("bar", version, platform, spec_fetcher, dependencies, metadata) expect(spec).to eql(spec) diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb index 0fdcb560b7..7997cb0c40 100644 --- a/spec/bundler/bundler/env_spec.rb +++ b/spec/bundler/bundler/env_spec.rb @@ -88,7 +88,7 @@ RSpec.describe Bundler::Env do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) end - let(:output) { described_class.report(:print_gemfile => true) } + let(:output) { described_class.report(print_gemfile: true) } it "prints the Gemfile" do expect(output).to include("Gemfile") @@ -102,7 +102,7 @@ RSpec.describe Bundler::Env do end context "when there no Gemfile and print_gemfile is true" do - let(:output) { described_class.report(:print_gemfile => true) } + let(:output) { described_class.report(print_gemfile: true) } it "prints the environment" do expect(output).to start_with("## Environment") @@ -114,7 +114,7 @@ RSpec.describe Bundler::Env do bundle "config set https://localgemserver.test/ user:pass" end - let(:output) { described_class.report(:print_gemfile => true) } + let(:output) { described_class.report(print_gemfile: true) } it "prints the config with redacted values" do expect(output).to include("https://localgemserver.test") @@ -128,7 +128,7 @@ RSpec.describe Bundler::Env do bundle "config set https://localgemserver.test/ api_token:x-oauth-basic" end - let(:output) { described_class.report(:print_gemfile => true) } + let(:output) { described_class.report(print_gemfile: true) } it "prints the config with redacted values" do expect(output).to include("https://localgemserver.test") @@ -158,7 +158,7 @@ RSpec.describe Bundler::Env do end it "prints the gemspec" do - output = described_class.report(:print_gemspecs => true) + output = described_class.report(print_gemspecs: true) expect(output).to include("foo.gemspec") expect(output).to include(gemspec) @@ -177,7 +177,7 @@ RSpec.describe Bundler::Env do allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app) - output = described_class.report(:print_gemspecs => true) + output = described_class.report(print_gemspecs: true) expect(output).to include(<<~ENV) ## Gemfile diff --git a/spec/bundler/bundler/fetcher/compact_index_spec.rb b/spec/bundler/bundler/fetcher/compact_index_spec.rb index d17889f8d6..9889d3cede 100644 --- a/spec/bundler/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/bundler/fetcher/compact_index_spec.rb @@ -6,7 +6,7 @@ require "bundler/compact_index_client" RSpec.describe Bundler::Fetcher::CompactIndex do let(:downloader) { double(:downloader) } let(:display_uri) { Bundler::URI("http://sampleuri.com") } - let(:remote) { double(:remote, :cache_slug => "lsjdf", :uri => display_uri) } + let(:remote) { double(:remote, cache_slug: "lsjdf", uri: display_uri) } let(:gem_remote_fetcher) { nil } let(:compact_index) { described_class.new(downloader, remote, display_uri, gem_remote_fetcher) } @@ -34,7 +34,7 @@ RSpec.describe Bundler::Fetcher::CompactIndex do describe "#available?" do before do allow(compact_index).to receive(:compact_index_client). - and_return(double(:compact_index_client, :update_and_parse_checksums! => true)) + and_return(double(:compact_index_client, update_and_parse_checksums!: true)) end it "returns true" do diff --git a/spec/bundler/bundler/fetcher/dependency_spec.rb b/spec/bundler/bundler/fetcher/dependency_spec.rb index 2db31b1846..262ae39463 100644 --- a/spec/bundler/bundler/fetcher/dependency_spec.rb +++ b/spec/bundler/bundler/fetcher/dependency_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Bundler::Fetcher::Dependency do let(:downloader) { double(:downloader) } - let(:remote) { double(:remote, :uri => Bundler::URI("http://localhost:5000")) } + let(:remote) { double(:remote, uri: Bundler::URI("http://localhost:5000")) } let(:display_uri) { "http://sample_uri.com" } let(:gem_remote_fetcher) { nil } @@ -211,7 +211,7 @@ RSpec.describe Bundler::Fetcher::Dependency do let(:gem_names) { [%w[foo bar], %w[bundler rubocop]] } let(:dep_api_uri) { double(:dep_api_uri) } let(:unmarshalled_gems) { double(:unmarshalled_gems) } - let(:fetch_response) { double(:fetch_response, :body => double(:body)) } + let(:fetch_response) { double(:fetch_response, body: double(:body)) } let(:rubygems_limit) { 50 } before { allow(subject).to receive(:dependency_api_uri).with(gem_names).and_return(dep_api_uri) } @@ -228,20 +228,20 @@ RSpec.describe Bundler::Fetcher::Dependency do let(:gem_list) do [ { - :dependencies => { + dependencies: { "resque" => "req3,req4", }, - :name => "typhoeus", - :number => "1.0.1", - :platform => "ruby", + name: "typhoeus", + number: "1.0.1", + platform: "ruby", }, { - :dependencies => { + dependencies: { "faraday" => "req1,req2", }, - :name => "grape", - :number => "2.0.2", - :platform => "jruby", + name: "grape", + number: "2.0.2", + platform: "jruby", }, ] end diff --git a/spec/bundler/bundler/fetcher/index_spec.rb b/spec/bundler/bundler/fetcher/index_spec.rb index f3cdc235ba..eea0050a6b 100644 --- a/spec/bundler/bundler/fetcher/index_spec.rb +++ b/spec/bundler/bundler/fetcher/index_spec.rb @@ -73,7 +73,7 @@ RSpec.describe Bundler::Fetcher::Index do context "any other message is returned" do let(:error_message) { "You get an error, you get an error!" } - before { allow(Bundler).to receive(:ui).and_return(double(:trace => nil)) } + before { allow(Bundler).to receive(:ui).and_return(double(trace: nil)) } it "should raise a Bundler::HTTPError" do expect { subject.specs(gem_names) }.to raise_error(Bundler::HTTPError, "Could not fetch specs from http://sample_uri.com due to underlying error <You get an error, you get an error! (http://sample_uri.com)>") diff --git a/spec/bundler/bundler/fetcher_spec.rb b/spec/bundler/bundler/fetcher_spec.rb index f764c44fae..53d201d31d 100644 --- a/spec/bundler/bundler/fetcher_spec.rb +++ b/spec/bundler/bundler/fetcher_spec.rb @@ -4,7 +4,7 @@ require "bundler/fetcher" RSpec.describe Bundler::Fetcher do let(:uri) { Bundler::URI("https://example.com") } - let(:remote) { double("remote", :uri => uri, :original_uri => nil) } + let(:remote) { double("remote", uri: uri, original_uri: nil) } subject(:fetcher) { Bundler::Fetcher.new(remote) } @@ -47,7 +47,7 @@ RSpec.describe Bundler::Fetcher do context "when a rubygems source mirror is set" do let(:orig_uri) { Bundler::URI("http://zombo.com") } let(:remote_with_mirror) do - double("remote", :uri => uri, :original_uri => orig_uri, :anonymized_uri => uri) + double("remote", uri: uri, original_uri: orig_uri, anonymized_uri: uri) end let(:fetcher) { Bundler::Fetcher.new(remote_with_mirror) } @@ -61,7 +61,7 @@ RSpec.describe Bundler::Fetcher do context "when there is no rubygems source mirror set" do let(:remote_no_mirror) do - double("remote", :uri => uri, :original_uri => nil, :anonymized_uri => uri) + double("remote", uri: uri, original_uri: nil, anonymized_uri: uri) end let(:fetcher) { Bundler::Fetcher.new(remote_no_mirror) } @@ -114,9 +114,9 @@ RSpec.describe Bundler::Fetcher do context "when gem ssl configuration is set" do before do allow(Gem.configuration).to receive_messages( - :http_proxy => nil, - :ssl_client_cert => "cert", - :ssl_ca_cert => "ca" + http_proxy: nil, + ssl_client_cert: "cert", + ssl_ca_cert: "ca" ) expect(File).to receive(:read).and_return("") expect(OpenSSL::X509::Certificate).to receive(:new).and_return("cert") @@ -167,7 +167,7 @@ RSpec.describe Bundler::Fetcher do let(:version) { "1.3.17" } let(:platform) { "platform" } let(:downloader) { double("downloader") } - let(:body) { double(Net::HTTP::Get, :body => downloaded_data) } + let(:body) { double(Net::HTTP::Get, body: downloaded_data) } context "when attempting to load a Gem::Specification" do let(:spec) { Gem::Specification.new(name, version) } @@ -194,10 +194,10 @@ RSpec.describe Bundler::Fetcher do describe "#specs_with_retry" do let(:downloader) { double(:downloader) } - let(:remote) { double(:remote, :cache_slug => "slug", :uri => uri, :original_uri => nil, :anonymized_uri => uri) } - let(:compact_index) { double(Bundler::Fetcher::CompactIndex, :available? => true, :api_fetcher? => true) } - let(:dependency) { double(Bundler::Fetcher::Dependency, :available? => true, :api_fetcher? => true) } - let(:index) { double(Bundler::Fetcher::Index, :available? => true, :api_fetcher? => false) } + let(:remote) { double(:remote, cache_slug: "slug", uri: uri, original_uri: nil, anonymized_uri: uri) } + let(:compact_index) { double(Bundler::Fetcher::CompactIndex, available?: true, api_fetcher?: true) } + let(:dependency) { double(Bundler::Fetcher::Dependency, available?: true, api_fetcher?: true) } + let(:index) { double(Bundler::Fetcher::Index, available?: true, api_fetcher?: false) } before do allow(Bundler::Fetcher::CompactIndex).to receive(:new).and_return(compact_index) @@ -230,10 +230,10 @@ RSpec.describe Bundler::Fetcher do describe "#api_fetcher?" do let(:downloader) { double(:downloader) } - let(:remote) { double(:remote, :cache_slug => "slug", :uri => uri, :original_uri => nil, :anonymized_uri => uri) } - let(:compact_index) { double(Bundler::Fetcher::CompactIndex, :available? => false, :api_fetcher? => true) } - let(:dependency) { double(Bundler::Fetcher::Dependency, :available? => false, :api_fetcher? => true) } - let(:index) { double(Bundler::Fetcher::Index, :available? => true, :api_fetcher? => false) } + let(:remote) { double(:remote, cache_slug: "slug", uri: uri, original_uri: nil, anonymized_uri: uri) } + let(:compact_index) { double(Bundler::Fetcher::CompactIndex, available?: false, api_fetcher?: true) } + let(:dependency) { double(Bundler::Fetcher::Dependency, available?: false, api_fetcher?: true) } + let(:index) { double(Bundler::Fetcher::Index, available?: true, api_fetcher?: false) } before do allow(Bundler::Fetcher::CompactIndex).to receive(:new).and_return(compact_index) diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb index 37afe488f3..cda2ef31de 100644 --- a/spec/bundler/bundler/friendly_errors_spec.rb +++ b/spec/bundler/bundler/friendly_errors_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Bundler, "friendly errors" do gem "rack" G - bundle :install, :env => { "DEBUG" => "true" } + bundle :install, env: { "DEBUG" => "true" } expect(err).to include("Failed to load #{home(".gemrc")}") end @@ -101,7 +101,7 @@ RSpec.describe Bundler, "friendly errors" do context "BundlerError" do it "Bundler.ui receive error" do error = Bundler::BundlerError.new - expect(Bundler.ui).to receive(:error).with(error.message, :wrap => true) + expect(Bundler.ui).to receive(:error).with(error.message, wrap: true) Bundler::FriendlyErrors.log_error(error) end end @@ -121,7 +121,7 @@ RSpec.describe Bundler, "friendly errors" do context "Gem::InvalidSpecificationException" do it "Bundler.ui receive error" do error = Gem::InvalidSpecificationException.new - expect(Bundler.ui).to receive(:error).with(error.message, :wrap => true) + expect(Bundler.ui).to receive(:error).with(error.message, wrap: true) Bundler::FriendlyErrors.log_error(error) end end diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb index 7d955007ab..940e5df9de 100644 --- a/spec/bundler/bundler/gem_helper_spec.rb +++ b/spec/bundler/bundler/gem_helper_spec.rb @@ -253,11 +253,11 @@ RSpec.describe Bundler::GemHelper do end before do - sys_exec("git init", :dir => app_path) - sys_exec("git config user.email \"[email protected]\"", :dir => app_path) - sys_exec("git config user.name \"name\"", :dir => app_path) - sys_exec("git config commit.gpgsign false", :dir => app_path) - sys_exec("git config push.default simple", :dir => app_path) + sys_exec("git init", dir: app_path) + sys_exec("git config user.email \"[email protected]\"", dir: app_path) + sys_exec("git config user.name \"name\"", dir: app_path) + sys_exec("git config commit.gpgsign false", dir: app_path) + sys_exec("git config push.default simple", dir: app_path) # silence messages allow(Bundler.ui).to receive(:confirm) @@ -271,23 +271,23 @@ RSpec.describe Bundler::GemHelper do end it "when there are uncommitted files" do - sys_exec("git add .", :dir => app_path) + sys_exec("git add .", dir: app_path) expect { Rake.application["release"].invoke }. to raise_error("There are files that need to be committed first.") end it "when there is no git remote" do - sys_exec("git commit -a -m \"initial commit\"", :dir => app_path) + sys_exec("git commit -a -m \"initial commit\"", dir: app_path) expect { Rake.application["release"].invoke }.to raise_error(RuntimeError) end end context "succeeds" do - let(:repo) { build_git("foo", :bare => true) } + let(:repo) { build_git("foo", bare: true) } before do - sys_exec("git remote add origin #{file_uri_for(repo.path)}", :dir => app_path) - sys_exec('git commit -a -m "initial commit"', :dir => app_path) + sys_exec("git remote add origin #{file_uri_for(repo.path)}", dir: app_path) + sys_exec('git commit -a -m "initial commit"', dir: app_path) end context "on releasing" do @@ -296,7 +296,7 @@ RSpec.describe Bundler::GemHelper do mock_confirm_message "Tagged v#{app_version}." mock_confirm_message "Pushed git commits and release tag." - sys_exec("git push -u origin main", :dir => app_path) + sys_exec("git push -u origin main", dir: app_path) end it "calls rubygem_push with proper arguments" do @@ -314,8 +314,8 @@ RSpec.describe Bundler::GemHelper do it "also works when releasing from an ambiguous reference" do # Create a branch with the same name as the tag - sys_exec("git checkout -b v#{app_version}", :dir => app_path) - sys_exec("git push -u origin v#{app_version}", :dir => app_path) + sys_exec("git checkout -b v#{app_version}", dir: app_path) + sys_exec("git push -u origin v#{app_version}", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) @@ -323,7 +323,7 @@ RSpec.describe Bundler::GemHelper do end it "also works with releasing from a branch not yet pushed" do - sys_exec("git checkout -b module_function", :dir => app_path) + sys_exec("git checkout -b module_function", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) @@ -337,7 +337,7 @@ RSpec.describe Bundler::GemHelper do mock_build_message app_name, app_version mock_confirm_message "Pushed git commits and release tag." - sys_exec("git push -u origin main", :dir => app_path) + sys_exec("git push -u origin main", dir: app_path) expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) end @@ -353,7 +353,7 @@ RSpec.describe Bundler::GemHelper do mock_confirm_message "Tag v#{app_version} has already been created." expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) - sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", :dir => app_path) + sys_exec("git tag -a -m \"Version #{app_version}\" v#{app_version}", dir: app_path) Rake.application["release"].invoke end @@ -374,10 +374,10 @@ RSpec.describe Bundler::GemHelper do end before do - sys_exec("git init", :dir => app_path) - sys_exec("git config user.email \"[email protected]\"", :dir => app_path) - sys_exec("git config user.name \"name\"", :dir => app_path) - sys_exec("git config push.gpgsign simple", :dir => app_path) + sys_exec("git init", dir: app_path) + sys_exec("git config user.email \"[email protected]\"", dir: app_path) + sys_exec("git config user.name \"name\"", dir: app_path) + sys_exec("git config push.gpgsign simple", dir: app_path) # silence messages allow(Bundler.ui).to receive(:confirm) diff --git a/spec/bundler/bundler/gem_version_promoter_spec.rb b/spec/bundler/bundler/gem_version_promoter_spec.rb index 8058412f32..fccbb58fea 100644 --- a/spec/bundler/bundler/gem_version_promoter_spec.rb +++ b/spec/bundler/bundler/gem_version_promoter_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::GemVersionPromoter do end def build_package(name, version, locked = []) - Bundler::Resolver::Package.new(name, [], :locked_specs => Bundler::SpecSet.new(build_spec(name, version)), :unlock => locked) + Bundler::Resolver::Package.new(name, [], locked_specs: Bundler::SpecSet.new(build_spec(name, version)), unlock: locked) end def sorted_versions(candidates:, current:, name: "foo", locked: []) @@ -32,13 +32,13 @@ RSpec.describe Bundler::GemVersionPromoter do end it "numerically sorts versions" do - versions = sorted_versions(:candidates => %w[1.7.7 1.7.8 1.7.9 1.7.15 1.8.0], :current => "1.7.8") + versions = sorted_versions(candidates: %w[1.7.7 1.7.8 1.7.9 1.7.15 1.8.0], current: "1.7.8") expect(versions).to eq %w[1.7.7 1.7.8 1.7.9 1.7.15 1.8.0] end context "with no options" do it "defaults to level=:major, strict=false, pre=false" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0] end end @@ -50,7 +50,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :major } it "keeps downgrades" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0] end end @@ -59,7 +59,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :minor } it "removes downgrades and major upgrades" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.3.0 0.3.1 0.9.0] end end @@ -68,7 +68,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :patch } it "removes downgrades and major and minor upgrades" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.3.0 0.3.1] end end @@ -81,7 +81,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :major } it "orders by version" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0] end end @@ -90,7 +90,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :minor } it "favors downgrades, then upgrades by major descending, minor ascending, patch ascending" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.2.0 2.0.1 2.1.0 1.0.0 0.3.0 0.3.1 0.9.0] end end @@ -99,7 +99,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :patch } it "favors downgrades, then upgrades by major descending, minor descending, patch ascending" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], :current => "0.3.0") + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.0.1 2.1.0], current: "0.3.0") expect(versions).to eq %w[0.2.0 2.1.0 2.0.1 1.0.0 0.9.0 0.3.0 0.3.1] end end @@ -109,7 +109,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.pre = true } it "sorts regardless of prerelease status" do - versions = sorted_versions(:candidates => %w[1.7.7.pre 1.8.0 1.8.1.pre 1.8.1 2.0.0.pre 2.0.0], :current => "1.8.0") + versions = sorted_versions(candidates: %w[1.7.7.pre 1.8.0 1.8.1.pre 1.8.1 2.0.0.pre 2.0.0], current: "1.8.0") expect(versions).to eq %w[1.7.7.pre 1.8.0 1.8.1.pre 1.8.1 2.0.0.pre 2.0.0] end end @@ -118,7 +118,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.pre = false } it "deprioritizes prerelease gems" do - versions = sorted_versions(:candidates => %w[1.7.7.pre 1.8.0 1.8.1.pre 1.8.1 2.0.0.pre 2.0.0], :current => "1.8.0") + versions = sorted_versions(candidates: %w[1.7.7.pre 1.8.0 1.8.1.pre 1.8.1 2.0.0.pre 2.0.0], current: "1.8.0") expect(versions).to eq %w[1.7.7.pre 1.8.1.pre 2.0.0.pre 1.8.0 1.8.1 2.0.0] end end @@ -127,7 +127,7 @@ RSpec.describe Bundler::GemVersionPromoter do before { gvp.level = :minor } it "keeps the current version last" do - versions = sorted_versions(:candidates => %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.1.0 2.0.1], :current => "0.3.0", :locked => ["bar"]) + versions = sorted_versions(candidates: %w[0.2.0 0.3.0 0.3.1 0.9.0 1.0.0 2.1.0 2.0.1], current: "0.3.0", locked: ["bar"]) expect(versions.last).to eq("0.3.0") end end diff --git a/spec/bundler/bundler/installer/gem_installer_spec.rb b/spec/bundler/bundler/installer/gem_installer_spec.rb index e86bdf009a..4b6a07f344 100644 --- a/spec/bundler/bundler/installer/gem_installer_spec.rb +++ b/spec/bundler/bundler/installer/gem_installer_spec.rb @@ -3,10 +3,10 @@ require "bundler/installer/gem_installer" RSpec.describe Bundler::GemInstaller do - let(:definition) { instance_double("Definition", :locked_gems => nil) } - let(:installer) { instance_double("Installer", :definition => definition) } + let(:definition) { instance_double("Definition", locked_gems: nil) } + let(:installer) { instance_double("Installer", definition: definition) } let(:spec_source) { instance_double("SpecSource") } - let(:spec) { instance_double("Specification", :name => "dummy", :version => "0.0.1", :loaded_from => "dummy", :source => spec_source) } + let(:spec) { instance_double("Specification", name: "dummy", version: "0.0.1", loaded_from: "dummy", source: spec_source) } subject { described_class.new(spec, installer) } @@ -14,7 +14,7 @@ RSpec.describe Bundler::GemInstaller do it "invokes install method with empty build_args" do allow(spec_source).to receive(:install).with( spec, - { :force => false, :ensure_builtin_gems_cached => false, :build_args => [], :previous_spec => nil } + { force: false, ensure_builtin_gems_cached: false, build_args: [], previous_spec: nil } ) subject.install_from_spec end @@ -28,7 +28,7 @@ RSpec.describe Bundler::GemInstaller do allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy") expect(spec_source).to receive(:install).with( spec, - { :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"], :previous_spec => nil } + { force: false, ensure_builtin_gems_cached: false, build_args: ["--with-dummy-config=dummy"], previous_spec: nil } ) subject.install_from_spec end @@ -42,7 +42,7 @@ RSpec.describe Bundler::GemInstaller do allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy --with-another-dummy-config") expect(spec_source).to receive(:install).with( spec, - { :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy", "--with-another-dummy-config"], :previous_spec => nil } + { force: false, ensure_builtin_gems_cached: false, build_args: ["--with-dummy-config=dummy", "--with-another-dummy-config"], previous_spec: nil } ) subject.install_from_spec end diff --git a/spec/bundler/bundler/installer/spec_installation_spec.rb b/spec/bundler/bundler/installer/spec_installation_spec.rb index c0ba05ad30..cbe2589b99 100644 --- a/spec/bundler/bundler/installer/spec_installation_spec.rb +++ b/spec/bundler/bundler/installer/spec_installation_spec.rb @@ -42,9 +42,9 @@ RSpec.describe Bundler::ParallelInstaller::SpecInstallation do context "when all dependencies are installed" do it "returns true" do dependencies = [] - dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => true, :all_dependencies => [], :type => :production) - dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) - all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] + dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: true, all_dependencies: [], type: :production) + dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) + all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] spec = described_class.new(dep) allow(spec).to receive(:all_dependencies).and_return(dependencies) installed_specs = all_specs.select(&:installed?).map {|s| [s.name, true] }.to_h @@ -55,9 +55,9 @@ RSpec.describe Bundler::ParallelInstaller::SpecInstallation do context "when all dependencies are not installed" do it "returns false" do dependencies = [] - dependencies << instance_double("SpecInstallation", :spec => "alpha", :name => "alpha", :installed? => false, :all_dependencies => [], :type => :production) - dependencies << instance_double("SpecInstallation", :spec => "beta", :name => "beta", :installed? => true, :all_dependencies => [], :type => :production) - all_specs = dependencies + [instance_double("SpecInstallation", :spec => "gamma", :name => "gamma", :installed? => false, :all_dependencies => [], :type => :production)] + dependencies << instance_double("SpecInstallation", spec: "alpha", name: "alpha", installed?: false, all_dependencies: [], type: :production) + dependencies << instance_double("SpecInstallation", spec: "beta", name: "beta", installed?: true, all_dependencies: [], type: :production) + all_specs = dependencies + [instance_double("SpecInstallation", spec: "gamma", name: "gamma", installed?: false, all_dependencies: [], type: :production)] spec = described_class.new(dep) allow(spec).to receive(:all_dependencies).and_return(dependencies) installed_specs = all_specs.select(&:installed?).map {|s| [s.name, true] }.to_h diff --git a/spec/bundler/bundler/plugin/dsl_spec.rb b/spec/bundler/bundler/plugin/dsl_spec.rb index 00e39dca69..235a549735 100644 --- a/spec/bundler/bundler/plugin/dsl_spec.rb +++ b/spec/bundler/bundler/plugin/dsl_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Bundler::Plugin::DSL do it "adds #source with :type to list and also inferred_plugins list" do expect(dsl).to receive(:plugin).with("bundler-source-news").once - dsl.source("some_random_url", :type => "news") {} + dsl.source("some_random_url", type: "news") {} expect(dsl.inferred_plugins).to eq(["bundler-source-news"]) end @@ -31,8 +31,8 @@ RSpec.describe Bundler::Plugin::DSL do it "registers a source type plugin only once for multiple declarations" do expect(dsl).to receive(:plugin).with("bundler-source-news").and_call_original.once - dsl.source("some_random_url", :type => "news") {} - dsl.source("another_random_url", :type => "news") {} + dsl.source("some_random_url", type: "news") {} + dsl.source("another_random_url", type: "news") {} end end end diff --git a/spec/bundler/bundler/plugin/installer_spec.rb b/spec/bundler/bundler/plugin/installer_spec.rb index 2c50ee5afc..bbca97e947 100644 --- a/spec/bundler/bundler/plugin/installer_spec.rb +++ b/spec/bundler/bundler/plugin/installer_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::Plugin::Installer do allow(installer).to receive(:install_git). and_return("new-plugin" => spec) - expect(installer.install(["new-plugin"], :git => "https://some.ran/dom")). + expect(installer.install(["new-plugin"], git: "https://some.ran/dom")). to eq("new-plugin" => spec) end @@ -29,7 +29,7 @@ RSpec.describe Bundler::Plugin::Installer do allow(installer).to receive(:install_local_git). and_return("new-plugin" => spec) - expect(installer.install(["new-plugin"], :local_git => "/phony/path/repo")). + expect(installer.install(["new-plugin"], local_git: "/phony/path/repo")). to eq("new-plugin" => spec) end @@ -37,7 +37,7 @@ RSpec.describe Bundler::Plugin::Installer do allow(installer).to receive(:install_rubygems). and_return("new-plugin" => spec) - expect(installer.install(["new-plugin"], :source => "https://some.ran/dom")). + expect(installer.install(["new-plugin"], source: "https://some.ran/dom")). to eq("new-plugin" => spec) end end @@ -52,13 +52,13 @@ RSpec.describe Bundler::Plugin::Installer do context "git plugins" do before do - build_git "ga-plugin", :path => lib_path("ga-plugin") do |s| + build_git "ga-plugin", path: lib_path("ga-plugin") do |s| s.write "plugins.rb" end end let(:result) do - installer.install(["ga-plugin"], :git => file_uri_for(lib_path("ga-plugin"))) + installer.install(["ga-plugin"], git: file_uri_for(lib_path("ga-plugin"))) end it "returns the installed spec after installing" do @@ -75,13 +75,13 @@ RSpec.describe Bundler::Plugin::Installer do context "local git plugins" do before do - build_git "ga-plugin", :path => lib_path("ga-plugin") do |s| + build_git "ga-plugin", path: lib_path("ga-plugin") do |s| s.write "plugins.rb" end end let(:result) do - installer.install(["ga-plugin"], :local_git => lib_path("ga-plugin").to_s) + installer.install(["ga-plugin"], local_git: lib_path("ga-plugin").to_s) end it "returns the installed spec after installing" do @@ -98,7 +98,7 @@ RSpec.describe Bundler::Plugin::Installer do context "rubygems plugins" do let(:result) do - installer.install(["re-plugin"], :source => file_uri_for(gem_repo2)) + installer.install(["re-plugin"], source: file_uri_for(gem_repo2)) end it "returns the installed spec after installing " do @@ -113,7 +113,7 @@ RSpec.describe Bundler::Plugin::Installer do context "multiple plugins" do let(:result) do - installer.install(["re-plugin", "ma-plugin"], :source => file_uri_for(gem_repo2)) + installer.install(["re-plugin", "ma-plugin"], source: file_uri_for(gem_repo2)) end it "returns the installed spec after installing " do diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb index 1731a2085e..f41b4eff3a 100644 --- a/spec/bundler/bundler/plugin_spec.rb +++ b/spec/bundler/bundler/plugin_spec.rb @@ -9,11 +9,11 @@ RSpec.describe Bundler::Plugin do let(:spec2) { double(:spec2) } before do - build_lib "new-plugin", :path => lib_path("new-plugin") do |s| + build_lib "new-plugin", path: lib_path("new-plugin") do |s| s.write "plugins.rb" end - build_lib "another-plugin", :path => lib_path("another-plugin") do |s| + build_lib "another-plugin", path: lib_path("another-plugin") do |s| s.write "plugins.rb" end @@ -275,7 +275,7 @@ RSpec.describe Bundler::Plugin do describe "#hook" do before do path = lib_path("foo-plugin") - build_lib "foo-plugin", :path => path do |s| + build_lib "foo-plugin", path: path do |s| s.write "plugins.rb", code end diff --git a/spec/bundler/bundler/remote_specification_spec.rb b/spec/bundler/bundler/remote_specification_spec.rb index 921a47a2d3..f35b231d58 100644 --- a/spec/bundler/bundler/remote_specification_spec.rb +++ b/spec/bundler/bundler/remote_specification_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Bundler::RemoteSpecification do end describe "#fetch_platform" do - let(:remote_spec) { double(:remote_spec, :platform => "jruby") } + let(:remote_spec) { double(:remote_spec, platform: "jruby") } before { allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) } @@ -113,7 +113,7 @@ RSpec.describe Bundler::RemoteSpecification do context "comparing a non sortable object" do let(:other) { Object.new } - let(:remote_spec) { double(:remote_spec, :platform => "jruby") } + let(:remote_spec) { double(:remote_spec, platform: "jruby") } before do allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) @@ -127,8 +127,8 @@ RSpec.describe Bundler::RemoteSpecification do end describe "#__swap__" do - let(:spec) { double(:spec, :dependencies => []) } - let(:new_spec) { double(:new_spec, :dependencies => [], :runtime_dependencies => []) } + let(:spec) { double(:spec, dependencies: []) } + let(:new_spec) { double(:new_spec, dependencies: [], runtime_dependencies: []) } before { subject.instance_variable_set(:@_remote_specification, spec) } @@ -157,7 +157,7 @@ RSpec.describe Bundler::RemoteSpecification do describe "method missing" do context "and is present in Gem::Specification" do - let(:remote_spec) { double(:remote_spec, :authors => "abcd") } + let(:remote_spec) { double(:remote_spec, authors: "abcd") } before do allow(subject).to receive(:_remote_specification).and_return(remote_spec) @@ -172,7 +172,7 @@ RSpec.describe Bundler::RemoteSpecification do describe "respond to missing?" do context "and is present in Gem::Specification" do - let(:remote_spec) { double(:remote_spec, :authors => "abcd") } + let(:remote_spec) { double(:remote_spec, authors: "abcd") } before do allow(subject).to receive(:_remote_specification).and_return(remote_spec) diff --git a/spec/bundler/bundler/resolver/candidate_spec.rb b/spec/bundler/bundler/resolver/candidate_spec.rb index cd52c867c4..f7b378d32b 100644 --- a/spec/bundler/bundler/resolver/candidate_spec.rb +++ b/spec/bundler/bundler/resolver/candidate_spec.rb @@ -2,7 +2,7 @@ RSpec.describe Bundler::Resolver::Candidate do it "compares fine" do - version1 = described_class.new("1.12.5", :specs => [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::RUBY }]) + version1 = described_class.new("1.12.5", specs: [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::RUBY }]) version2 = described_class.new("1.12.5") # passing no specs creates a platform specific candidate, so sorts higher expect(version2 >= version1).to be true @@ -13,8 +13,8 @@ RSpec.describe Bundler::Resolver::Candidate do expect(version1.platform_specific! >= version2.generic!).to be true expect(version2.platform_specific! >= version1.generic!).to be true - version1 = described_class.new("1.12.5", :specs => [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::RUBY }]) - version2 = described_class.new("1.12.5", :specs => [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::X64_LINUX }]) + version1 = described_class.new("1.12.5", specs: [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::RUBY }]) + version2 = described_class.new("1.12.5", specs: [Gem::Specification.new("foo", "1.12.5") {|s| s.platform = Gem::Platform::X64_LINUX }]) expect(version2 >= version1).to be true end diff --git a/spec/bundler/bundler/ruby_dsl_spec.rb b/spec/bundler/bundler/ruby_dsl_spec.rb index c91804d96a..90e1778f68 100644 --- a/spec/bundler/bundler/ruby_dsl_spec.rb +++ b/spec/bundler/bundler/ruby_dsl_spec.rb @@ -17,9 +17,9 @@ RSpec.describe Bundler::RubyDsl do let(:engine_version) { "9000" } let(:patchlevel) { "100" } let(:options) do - { :patchlevel => patchlevel, - :engine => engine, - :engine_version => engine_version } + { patchlevel: patchlevel, + engine: engine, + engine_version: engine_version } end let(:project_root) { Pathname.new("/path/to/project") } before { allow(Bundler).to receive(:root).and_return(project_root) } @@ -110,10 +110,10 @@ RSpec.describe Bundler::RubyDsl do context "with a file option" do let(:file) { ".ruby-version" } let(:options) do - { :file => file, - :patchlevel => patchlevel, - :engine => engine, - :engine_version => engine_version } + { file: file, + patchlevel: patchlevel, + engine: engine, + engine_version: engine_version } end let(:ruby_version_arg) { nil } let(:file_content) { "#{version}\n" } diff --git a/spec/bundler/bundler/rubygems_integration_spec.rb b/spec/bundler/bundler/rubygems_integration_spec.rb index b10e8ac6b5..d4e6957a01 100644 --- a/spec/bundler/bundler/rubygems_integration_spec.rb +++ b/spec/bundler/bundler/rubygems_integration_spec.rb @@ -63,7 +63,7 @@ RSpec.describe Bundler::RubygemsIntegration do context "when a rubygems source mirror is set" do let(:orig_uri) { Bundler::URI("http://zombo.com") } - let(:remote_with_mirror) { double("remote", :uri => uri, :original_uri => orig_uri) } + let(:remote_with_mirror) { double("remote", uri: uri, original_uri: orig_uri) } it "sets the 'X-Gemfile-Source' header containing the original source" do expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response) @@ -74,7 +74,7 @@ RSpec.describe Bundler::RubygemsIntegration do end context "when there is no rubygems source mirror set" do - let(:remote_no_mirror) { double("remote", :uri => uri, :original_uri => nil) } + let(:remote_no_mirror) { double("remote", uri: uri, original_uri: nil) } it "does not set the 'X-Gemfile-Source' header" do expect(fetcher).to receive(:fetch_path).with(uri + "specs.4.8.gz").and_return(specs_response) @@ -85,7 +85,7 @@ RSpec.describe Bundler::RubygemsIntegration do end context "when loading an unexpected class" do - let(:remote_no_mirror) { double("remote", :uri => uri, :original_uri => nil) } + let(:remote_no_mirror) { double("remote", uri: uri, original_uri: nil) } let(:unexpected_specs_response) { Marshal.dump(3) } it "raises a MarshalError error" do diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb index 4636993d9f..27686e0c7a 100644 --- a/spec/bundler/bundler/settings_spec.rb +++ b/spec/bundler/bundler/settings_spec.rb @@ -131,7 +131,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow Bundler.settings.set_command_option :no_install, true - Bundler.settings.temporary(:no_install => false) do + Bundler.settings.temporary(no_install: false) do expect(Bundler.settings[:no_install]).to eq false end @@ -147,12 +147,12 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow context "when called without a block" do it "leaves the setting changed" do - Bundler.settings.temporary(:foo => :random) + Bundler.settings.temporary(foo: :random) expect(Bundler.settings[:foo]).to eq "random" end it "returns nil" do - expect(Bundler.settings.temporary(:foo => :bar)).to be_nil + expect(Bundler.settings.temporary(foo: :bar)).to be_nil end end end diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb index e081385bbe..d40a1afde3 100644 --- a/spec/bundler/bundler/shared_helpers_spec.rb +++ b/spec/bundler/bundler/shared_helpers_spec.rb @@ -529,16 +529,16 @@ RSpec.describe Bundler::SharedHelpers do it "prints and raises nothing below the deprecated major version" do subject.major_deprecation(38, "Message") - subject.major_deprecation(39, "Message", :removed_message => "Removal", :print_caller_location => true) + subject.major_deprecation(39, "Message", removed_message: "Removal", print_caller_location: true) expect(Bundler.ui).not_to have_received(:warn) end it "prints but does not raise _at_ the deprecated major version" do subject.major_deprecation(37, "Message") - subject.major_deprecation(37, "Message", :removed_message => "Removal") + subject.major_deprecation(37, "Message", removed_message: "Removal") expect(Bundler.ui).to have_received(:warn).with("[DEPRECATED] Message").twice - subject.major_deprecation(37, "Message", :print_caller_location => true) + subject.major_deprecation(37, "Message", print_caller_location: true) expect(Bundler.ui).to have_received(:warn). with(a_string_matching(/^\[DEPRECATED\] Message \(called at .*:\d+\)$/)) end @@ -546,9 +546,9 @@ RSpec.describe Bundler::SharedHelpers do it "raises the appropriate errors when _past_ the deprecated major version" do expect { subject.major_deprecation(36, "Message") }. to raise_error(Bundler::DeprecatedError, "[REMOVED] Message") - expect { subject.major_deprecation(36, "Message", :removed_message => "Removal") }. + expect { subject.major_deprecation(36, "Message", removed_message: "Removal") }. to raise_error(Bundler::DeprecatedError, "[REMOVED] Removal") - expect { subject.major_deprecation(35, "Message", :removed_message => "Removal", :print_caller_location => true) }. + expect { subject.major_deprecation(35, "Message", removed_message: "Removal", print_caller_location: true) }. to raise_error(Bundler::DeprecatedError, /^\[REMOVED\] Removal \(called at .*:\d+\)$/) end end diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb index 457cbea4b6..1450316d59 100644 --- a/spec/bundler/bundler/source/git/git_proxy_spec.rb +++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do let(:options) { { "ref" => ref, "branch" => branch, "tag" => tag }.compact } let(:revision) { nil } let(:git_source) { nil } - let(:clone_result) { double(Process::Status, :success? => true) } + let(:clone_result) { double(Process::Status, success?: true) } let(:base_clone_args) { ["clone", "--bare", "--no-hardlinks", "--quiet", "--no-tags", "--depth", "1", "--single-branch"] } subject(:git_proxy) { described_class.new(path, uri, options, revision, git_source) } @@ -193,7 +193,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do FileUtils.chmod("+x", file) - bundle :lock, :raise_on_error => false + bundle :lock, raise_on_error: false expect(Pathname.new(bundled_app("canary"))).not_to exist end diff --git a/spec/bundler/bundler/source/git_spec.rb b/spec/bundler/bundler/source/git_spec.rb index ed6dc3cd29..feef54bbf4 100644 --- a/spec/bundler/bundler/source/git_spec.rb +++ b/spec/bundler/bundler/source/git_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Bundler::Source::Git do context "when the source has a reference" do let(:git_proxy_stub) do - instance_double(Bundler::Source::Git::GitProxy, :revision => "123abc", :branch => "v1.0.0") + instance_double(Bundler::Source::Git::GitProxy, revision: "123abc", branch: "v1.0.0") end let(:options) do { "uri" => uri, "ref" => "v1.0.0" } @@ -55,7 +55,7 @@ RSpec.describe Bundler::Source::Git do context "when the source has both reference and glob specifiers" do let(:git_proxy_stub) do - instance_double(Bundler::Source::Git::GitProxy, :revision => "123abc", :branch => "v1.0.0") + instance_double(Bundler::Source::Git::GitProxy, revision: "123abc", branch: "v1.0.0") end let(:options) do { "uri" => uri, "ref" => "v1.0.0", "glob" => "gems/foo/*.gemspec" } diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb index f860e9ff58..15811f83dc 100644 --- a/spec/bundler/bundler/source_list_spec.rb +++ b/spec/bundler/bundler/source_list_spec.rb @@ -85,7 +85,7 @@ RSpec.describe Bundler::SourceList do end it "ignores git protocols on request" do - Bundler.settings.temporary(:"git.allow_insecure" => true) + Bundler.settings.temporary("git.allow_insecure": true) expect(Bundler.ui).to_not receive(:warn).with(msg) source_list.add_git_source("uri" => "git://existing-git.org/path.git") end diff --git a/spec/bundler/bundler/source_spec.rb b/spec/bundler/bundler/source_spec.rb index ceb369ecdb..3b49c37431 100644 --- a/spec/bundler/bundler/source_spec.rb +++ b/spec/bundler/bundler/source_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::Source do end describe "#version_message" do - let(:spec) { double(:spec, :name => "nokogiri", :version => ">= 1.6", :platform => rb) } + let(:spec) { double(:spec, name: "nokogiri", version: ">= 1.6", platform: rb) } shared_examples_for "the lockfile specs are not relevant" do it "should return a string with the spec name and version" do @@ -32,19 +32,19 @@ RSpec.describe Bundler::Source do context "when there are locked gems" do context "that contain the relevant gem spec" do context "without a version" do - let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => nil) } + let(:locked_gem) { double(:locked_gem, name: "nokogiri", version: nil) } it_behaves_like "the lockfile specs are not relevant" end context "with the same version" do - let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => ">= 1.6") } + let(:locked_gem) { double(:locked_gem, name: "nokogiri", version: ">= 1.6") } it_behaves_like "the lockfile specs are not relevant" end context "with a different version" do - let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "< 1.5") } + let(:locked_gem) { double(:locked_gem, name: "nokogiri", version: "< 1.5") } context "with color", :no_color_tty do before do @@ -70,8 +70,8 @@ RSpec.describe Bundler::Source do end context "with a more recent version" do - let(:spec) { double(:spec, :name => "nokogiri", :version => "1.6.1", :platform => rb) } - let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") } + let(:spec) { double(:spec, name: "nokogiri", version: "1.6.1", platform: rb) } + let(:locked_gem) { double(:locked_gem, name: "nokogiri", version: "1.7.0") } context "with color", :no_color_tty do before do @@ -97,8 +97,8 @@ RSpec.describe Bundler::Source do end context "with an older version" do - let(:spec) { double(:spec, :name => "nokogiri", :version => "1.7.1", :platform => rb) } - let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") } + let(:spec) { double(:spec, name: "nokogiri", version: "1.7.1", platform: rb) } + let(:locked_gem) { double(:locked_gem, name: "nokogiri", version: "1.7.0") } context "with color", :no_color_tty do before do @@ -128,7 +128,7 @@ RSpec.describe Bundler::Source do describe "#can_lock?" do context "when the passed spec's source is equivalent" do - let(:spec) { double(:spec, :source => subject) } + let(:spec) { double(:spec, source: subject) } it "should return true" do expect(subject.can_lock?(spec)).to be_truthy @@ -136,7 +136,7 @@ RSpec.describe Bundler::Source do end context "when the passed spec's source is not equivalent" do - let(:spec) { double(:spec, :source => double(:other_source)) } + let(:spec) { double(:spec, source: double(:other_source)) } it "should return false" do expect(subject.can_lock?(spec)).to be_falsey diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb index 73c7db1e88..abbc2c3cf2 100644 --- a/spec/bundler/cache/gems_spec.rb +++ b/spec/bundler/cache/gems_spec.rb @@ -8,7 +8,7 @@ RSpec.describe "bundle cache" do gem 'rack' G - system_gems "rack-1.0.0", :path => path + system_gems "rack-1.0.0", path: path bundle :cache end @@ -17,7 +17,7 @@ RSpec.describe "bundle cache" do end it "uses the cache as a source when installing gems" do - build_gem "omg", :path => bundled_app("vendor/cache") + build_gem "omg", path: bundled_app("vendor/cache") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -28,14 +28,14 @@ RSpec.describe "bundle cache" do end it "uses the cache as a source when installing gems with --local" do - system_gems [], :path => default_bundle_path + system_gems [], path: default_bundle_path bundle "install --local" expect(the_bundle).to include_gems("rack 1.0.0") end it "does not reinstall gems from the cache if they exist on the system" do - build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") do |s| + build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| s.write "lib/rack.rb", "RACK = 'FAIL'" end @@ -48,18 +48,18 @@ RSpec.describe "bundle cache" do end it "does not reinstall gems from the cache if they exist in the bundle" do - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" G - build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") do |s| + build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| s.write "lib/rack.rb", "RACK = 'FAIL'" end - bundle :install, :local => true + bundle :install, local: true expect(the_bundle).to include_gems("rack 1.0.0") end @@ -97,12 +97,12 @@ RSpec.describe "bundle cache" do build_gem "json", default_json_version end - build_gem "json", default_json_version, :to_system => true, :default => true + build_gem "json", default_json_version, to_system: true, default: true end it "uses builtin gems when installing to system gems" do bundle "config set path.system true" - install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'json', '#{default_json_version}'), :verbose => true + install_gemfile %(source "#{file_uri_for(gem_repo1)}"; gem 'json', '#{default_json_version}'), verbose: true expect(out).to include("Using json #{default_json_version}") end @@ -131,7 +131,7 @@ RSpec.describe "bundle cache" do end it "doesn't make remote request after caching the gem" do - build_gem "builtin_gem_2", "1.0.2", :path => bundled_app("vendor/cache") do |s| + build_gem "builtin_gem_2", "1.0.2", path: bundled_app("vendor/cache") do |s| s.summary = "This builtin_gem is bundled with Ruby" end @@ -152,7 +152,7 @@ RSpec.describe "bundle cache" do gem 'json', '#{default_json_version}' G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false expect(exitstatus).to_not eq(0) expect(err).to include("json-#{default_json_version} is built in to Ruby, and can't be cached") end @@ -218,7 +218,7 @@ RSpec.describe "bundle cache" do end end - bundle "update", :all => true + bundle "update", all: true expect(cached_gem("rack-1.2")).to exist expect(cached_gem("rack-1.0.0")).not_to exist end @@ -279,8 +279,8 @@ RSpec.describe "bundle cache" do it "doesn't remove gems with mismatched :rubygems_version or :date" do cached_gem("rack-1.0.0").rmtree build_gem "rack", "1.0.0", - :path => bundled_app("vendor/cache"), - :rubygems_version => "1.3.2" + path: bundled_app("vendor/cache"), + rubygems_version: "1.3.2" # This test is only really valid if the checksum isn't saved. It otherwise can't be the same gem. Tested below. bundled_app_lock.write remove_checksums_from_lockfile(bundled_app_lock.read, "rack (1.0.0)") simulate_new_machine @@ -291,7 +291,7 @@ RSpec.describe "bundle cache" do it "raises an error when the gem is altered and produces a different checksum" do cached_gem("rack-1.0.0").rmtree - build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") + build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") checksums = checksums_section do |c| c.checksum gem_repo1, "rack", "1.0.0" @@ -307,7 +307,7 @@ RSpec.describe "bundle cache" do #{checksums} L - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(exitstatus).to eq(37) expect(err).to include("Bundler found mismatched checksums.") expect(err).to include("1. remove the gem at #{cached_gem("rack-1.0.0")}") @@ -320,7 +320,7 @@ RSpec.describe "bundle cache" do it "installs a modified gem with a non-matching checksum when checksums is not opted in" do cached_gem("rack-1.0.0").rmtree - build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") + build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") simulate_new_machine lockfile <<-L @@ -361,7 +361,7 @@ RSpec.describe "bundle cache" do it "should install gems with the name bundler in them (that aren't bundler)" do build_gem "foo-bundler", "1.0", - :path => bundled_app("vendor/cache") + path: bundled_app("vendor/cache") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb index 890ba88605..4b3cd4d2eb 100644 --- a/spec/bundler/cache/git_spec.rb +++ b/spec/bundler/cache/git_spec.rb @@ -89,7 +89,7 @@ RSpec.describe "bundle cache with git" do ref = git.ref_for("main", 11) expect(ref).not_to eq(old_ref) - bundle "update", :all => true + bundle "update", all: true bundle :cache expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist @@ -164,8 +164,8 @@ RSpec.describe "bundle cache with git" do s.add_dependency "submodule" end - sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0") - sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0") + sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", dir: lib_path("has_submodule-1.0") + sys_exec "git commit -m \"submodulator\"", dir: lib_path("has_submodule-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -216,7 +216,7 @@ RSpec.describe "bundle cache with git" do simulate_new_machine with_path_as "" do bundle "config set deployment true" - bundle :install, :local => true + bundle :install, local: true expect(the_bundle).to include_gem "foo 1.0" end end @@ -266,8 +266,8 @@ RSpec.describe "bundle cache with git" do # Verify that the compilation worked and the result is in $LOAD_PATH by simply attempting # to require it; that should make sure this spec does not break if the load path behaviour # is changed. - bundle :install, :local => true - ruby <<~R, :raise_on_error => false + bundle :install, local: true + ruby <<~R, raise_on_error: false require 'bundler/setup' require 'foo_c' R diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb index 2ad136a008..2c8a52617a 100644 --- a/spec/bundler/cache/path_spec.rb +++ b/spec/bundler/cache/path_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle cache with path" do it "is no-op when the path is within the bundle" do - build_lib "foo", :path => bundled_app("lib/foo") + build_lib "foo", path: bundled_app("lib/foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -35,7 +35,7 @@ RSpec.describe "bundle cache with path" do libname = File.basename(bundled_app) + "_gem" libpath = File.join(File.dirname(bundled_app), libname) - build_lib libname, :path => libpath + build_lib libname, path: libpath install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -97,7 +97,7 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "does not cache path gems by default", :bundler => "< 3" do + it "does not cache path gems by default", bundler: "< 3" do build_lib "foo" install_gemfile <<-G @@ -110,7 +110,7 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end - it "caches path gems by default", :bundler => "3" do + it "caches path gems by default", bundler: "3" do build_lib "foo" install_gemfile <<-G @@ -163,7 +163,7 @@ RSpec.describe "bundle cache with path" do gem "baz", :path => '#{lib_path("baz-1.0")}' G - bundle "cache --no-all", :raise_on_error => false + bundle "cache --no-all", raise_on_error: false expect(bundled_app("vendor/cache/baz-1.0")).not_to exist end end diff --git a/spec/bundler/cache/platform_spec.rb b/spec/bundler/cache/platform_spec.rb index 128278956c..36db954c79 100644 --- a/spec/bundler/cache/platform_spec.rb +++ b/spec/bundler/cache/platform_spec.rb @@ -41,7 +41,7 @@ RSpec.describe "bundle cache with multiple platforms" do end it "ensures that a successful bundle update does not delete gems for other platforms" do - bundle "update", :all => true + bundle "update", all: true expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index e1f79274aa..e2f5bbf42f 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -22,7 +22,7 @@ RSpec.describe "bundle add" do context "when no gems are specified" do it "shows error" do - bundle "add", :raise_on_error => false + bundle "add", raise_on_error: false expect(err).to include("Please specify gems to add") end @@ -131,7 +131,7 @@ RSpec.describe "bundle add" do describe "with --git and --branch" do before do - update_git "foo", "2.0", :branch => "test" + update_git "foo", "2.0", branch: "test" end it "adds dependency with specified git source and branch" do @@ -191,24 +191,24 @@ RSpec.describe "bundle add" do end it "shows error message when version is not formatted correctly" do - bundle "add 'foo' -v='~>1 . 0'", :raise_on_error => false + bundle "add 'foo' -v='~>1 . 0'", raise_on_error: false expect(err).to match("Invalid gem requirement pattern '~>1 . 0'") end it "shows error message when gem cannot be found" do bundle "config set force_ruby_platform true" - bundle "add 'werk_it'", :raise_on_error => false + bundle "add 'werk_it'", raise_on_error: false expect(err).to match("Could not find gem 'werk_it' in") - bundle "add 'werk_it' -s='#{file_uri_for(gem_repo2)}'", :raise_on_error => false + bundle "add 'werk_it' -s='#{file_uri_for(gem_repo2)}'", raise_on_error: false expect(err).to match("Could not find gem 'werk_it' in rubygems repository") end it "shows error message when source cannot be reached" do - bundle "add 'baz' --source='http://badhostasdf'", :raise_on_error => false + bundle "add 'baz' --source='http://badhostasdf'", raise_on_error: false expect(err).to include("Could not reach host badhostasdf. Check your network connection and try again.") - bundle "add 'baz' --source='file://does/not/exist'", :raise_on_error => false + bundle "add 'baz' --source='file://does/not/exist'", raise_on_error: false expect(err).to include("Could not fetch specs from file://does/not/exist/") end @@ -238,7 +238,7 @@ RSpec.describe "bundle add" do describe "with --optimistic and --strict" do it "throws error" do - bundle "add 'foo' --strict --optimistic", :raise_on_error => false + bundle "add 'foo' --strict --optimistic", raise_on_error: false expect(err).to include("You can not specify `--strict` and `--optimistic` at the same time") end @@ -253,7 +253,7 @@ RSpec.describe "bundle add" do end it "throws error if any of the specified gems are present in the gemfile with different version" do - bundle "add weakling bar", :raise_on_error => false + bundle "add weakling bar", raise_on_error: false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("You specified: weakling (~> 0.0.1) and weakling (>= 0).") @@ -267,7 +267,7 @@ RSpec.describe "bundle add" do gem "rack", "1.0" G - bundle "add 'rack' --version=1.1", :raise_on_error => false + bundle "add 'rack' --version=1.1", raise_on_error: false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") @@ -279,7 +279,7 @@ RSpec.describe "bundle add" do gem "rack", "1.0" G - bundle "add 'rack'", :raise_on_error => false + bundle "add 'rack'", raise_on_error: false expect(err).to include("Gem already added.") expect(err).to include("You cannot specify the same gem twice with different version requirements") @@ -294,7 +294,7 @@ RSpec.describe "bundle add" do gem "rack" G - bundle "add 'rack' --version=1.1", :raise_on_error => false + bundle "add 'rack' --version=1.1", raise_on_error: false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("If you want to update the gem version, run `bundle update rack`.") diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index bfbef58181..6c3dc7bb2d 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -45,7 +45,7 @@ RSpec.describe "bundle binstubs <gem>" do gem "rails" G - bundle :binstubs, :all => true + bundle :binstubs, all: true expect(bundled_app("bin/rails")).to exist expect(bundled_app("bin/rake")).to exist @@ -69,7 +69,7 @@ RSpec.describe "bundle binstubs <gem>" do gem "rack" G - bundle "binstubs", :raise_on_error => false + bundle "binstubs", raise_on_error: false expect(exitstatus).to eq(1) expect(err).to include("`bundle binstubs` needs at least one gem to run.") end @@ -80,7 +80,7 @@ RSpec.describe "bundle binstubs <gem>" do gem "rack" G - bundle "binstubs rack", :all => true, :raise_on_error => false + bundle "binstubs rack", all: true, raise_on_error: false expect(last_command).to be_failure expect(err).to include("Cannot specify --all with specific gems") end @@ -98,7 +98,7 @@ RSpec.describe "bundle binstubs <gem>" do file.print "OMG" end - sys_exec "bin/rackup", :raise_on_error => false + sys_exec "bin/rackup", raise_on_error: false expect(err).to include("was not generated by Bundler") end @@ -132,13 +132,13 @@ RSpec.describe "bundle binstubs <gem>" do let(:system_bundler_version) { Bundler::VERSION } it "runs bundler" do - sys_exec "bin/bundle install", :env => { "DEBUG" => "1" } + sys_exec "bin/bundle install", env: { "DEBUG" => "1" } expect(out).to include %(Using bundler #{system_bundler_version}\n) end context "when BUNDLER_VERSION is set" do it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" }, :raise_on_error => false + sys_exec "bin/bundle install", env: { "BUNDLER_VERSION" => "999.999.999" }, raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (999.999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") @@ -147,7 +147,7 @@ RSpec.describe "bundle binstubs <gem>" do it "runs the correct version of bundler even if a higher version is installed" do system_gems "bundler-999.999.998", "bundler-999.999.999" - sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.998", "DEBUG" => "1" }, :raise_on_error => false + sys_exec "bin/bundle install", env: { "BUNDLER_VERSION" => "999.999.998", "DEBUG" => "1" }, raise_on_error: false expect(out).to include %(Using bundler 999.999.998\n) end end @@ -159,7 +159,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :raise_on_error => false + sys_exec "bin/bundle install", raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -173,7 +173,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :env => { "BUNDLE_GEMFILE" => "gems.rb" }, :raise_on_error => false + sys_exec "bin/bundle install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). @@ -189,7 +189,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :raise_on_error => false + sys_exec "bin/bundle install", raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") @@ -205,7 +205,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :env => { "BUNDLE_GEMFILE" => "gems.rb" }, :raise_on_error => false + sys_exec "bin/bundle install", env: { "BUNDLE_GEMFILE" => "gems.rb" }, raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") @@ -219,15 +219,15 @@ 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", :realworld => true do - sys_exec "bin/bundle install --verbose", :artifice => "vcr" + 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.") expect(out).to include("Using bundler 2.3.0") expect(err).not_to include("Activating bundler (~> 2.3.0) failed:") end - it "runs the available version of bundler", :rubygems => "< 3.3.0.dev" do + it "runs the available version of bundler", rubygems: "< 3.3.0.dev" do sys_exec "bin/bundle install --verbose" expect(exitstatus).not_to eq(42) expect(out).not_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.") @@ -244,7 +244,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler when the version is a pre-release" do - sys_exec "bin/bundle install", :raise_on_error => false + sys_exec "bin/bundle install", raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 2.12.a) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`") @@ -256,7 +256,7 @@ RSpec.describe "bundle binstubs <gem>" do before { lockfile.gsub(system_bundler_version, "1.1.1") } it "calls through to the latest bundler version", :realworld do - sys_exec "bin/bundle update --bundler", :env => { "DEBUG" => "1" } + 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 latest_version = using_bundler_line[1] @@ -264,7 +264,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "calls through to the explicit bundler version" do - sys_exec "bin/bundle update --bundler=999.999.999", :raise_on_error => false + sys_exec "bin/bundle update --bundler=999.999.999", raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (999.999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`") @@ -274,7 +274,7 @@ RSpec.describe "bundle binstubs <gem>" do context "without a lockfile" do it "falls back to the latest installed bundler" do FileUtils.rm bundled_app_lock - sys_exec "bin/bundle install", :env => { "DEBUG" => "1" } + sys_exec "bin/bundle install", env: { "DEBUG" => "1" } expect(out).to include "Using bundler #{system_bundler_version}\n" end end @@ -289,7 +289,7 @@ RSpec.describe "bundle binstubs <gem>" do before { lockfile lockfile.gsub(Bundler::VERSION, "999.999.999") } it "attempts to load that version" do - sys_exec bundled_app("bin/rackup").to_s, :raise_on_error => false + sys_exec bundled_app("bin/rackup").to_s, raise_on_error: false expect(exitstatus).to eq(42) expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -301,7 +301,7 @@ RSpec.describe "bundle binstubs <gem>" do it "installs binstubs from git gems" do FileUtils.mkdir_p(lib_path("foo/bin")) FileUtils.touch(lib_path("foo/bin/foo")) - build_git "foo", "1.0", :path => lib_path("foo") do |s| + build_git "foo", "1.0", path: lib_path("foo") do |s| s.executables = %w[foo] end install_gemfile <<-G @@ -317,7 +317,7 @@ RSpec.describe "bundle binstubs <gem>" do it "installs binstubs from path gems" do FileUtils.mkdir_p(lib_path("foo/bin")) FileUtils.touch(lib_path("foo/bin/foo")) - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.executables = %w[foo] end install_gemfile <<-G @@ -362,7 +362,7 @@ RSpec.describe "bundle binstubs <gem>" do source "#{file_uri_for(gem_repo1)}" G - bundle "binstubs doesnt_exist", :raise_on_error => false + bundle "binstubs doesnt_exist", raise_on_error: false expect(exitstatus).to eq(7) expect(err).to include("Could not find gem 'doesnt_exist'.") @@ -381,14 +381,14 @@ RSpec.describe "bundle binstubs <gem>" do expect(bundled_app("exec/rackup")).to exist end - it "setting is saved for bundle install", :bundler => "< 3" do + it "setting is saved for bundle install", bundler: "< 3" do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" gem "rails" G - bundle "binstubs rack", :path => "exec" + bundle "binstubs rack", path: "exec" bundle :install expect(bundled_app("exec/rails")).to exist @@ -549,7 +549,7 @@ RSpec.describe "bundle binstubs <gem>" do G bundle "config set auto_install 1" - bundle "binstubs rack", :env => { "BUNDLE_INSTALL" => "1" } + bundle "binstubs rack", env: { "BUNDLE_INSTALL" => "1" } expect(out).not_to include("Installing rack 1.0.0") end end diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index a7ac6148f4..70e2c84961 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -158,7 +158,7 @@ RSpec.describe "bundle cache" do end end - context "with --path", :bundler => "< 3" do + context "with --path", bundler: "< 3" do it "sets root directory for gems" do gemfile <<-D source "#{file_uri_for(gem_repo1)}" @@ -211,7 +211,7 @@ RSpec.describe "bundle cache" do end context "with --all-platforms" do - it "puts the gems in vendor/cache even for other rubies", :bundler => ">= 2.4.0" do + it "puts the gems in vendor/cache even for other rubies", bundler: ">= 2.4.0" do gemfile <<-D source "#{file_uri_for(gem_repo1)}" gem 'rack', :platforms => [:ruby_20, :windows_20] @@ -221,7 +221,7 @@ RSpec.describe "bundle cache" do expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end - it "puts the gems in vendor/cache even for legacy windows rubies", :bundler => ">= 2.4.0" do + it "puts the gems in vendor/cache even for legacy windows rubies", bundler: ">= 2.4.0" do gemfile <<-D source "#{file_uri_for(gem_repo1)}" gem 'rack', :platforms => [:ruby_20, :x64_mingw_20] @@ -272,7 +272,7 @@ RSpec.describe "bundle cache" do end G - bundle :lock, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } + bundle :lock, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } bundle :cache, "all-platforms" => true, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo1.to_s } expect(bundled_app("vendor/cache/weakling-0.0.3.gem")).to exist end @@ -289,7 +289,7 @@ RSpec.describe "bundle cache" do subject do bundle "config set --local frozen true" - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false end it "tries to install with frozen" do @@ -393,7 +393,7 @@ RSpec.describe "bundle install with gem sources" do G bundle :cache - build_gem "rack", "1.0.0", :path => bundled_app("vendor/cache") do |s| + build_gem "rack", "1.0.0", path: bundled_app("vendor/cache") do |s| s.write "lib/rack.rb", "raise 'omg'" end diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index ca6a7d1e27..02f9bb5b7a 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -17,7 +17,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle "check --gemfile bundled_app/Gemfile", :dir => tmp + bundle "check --gemfile bundled_app/Gemfile", dir: tmp expect(out).to include("The Gemfile's dependencies are satisfied") end @@ -55,7 +55,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -65,7 +65,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(exitstatus).to be > 0 expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -88,11 +88,11 @@ RSpec.describe "bundle check" do gem "rails_pinned_to_old_activesupport" G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end - it "remembers --without option from install", :bundler => "< 3" do + it "remembers --without option from install", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" group :foo do @@ -132,7 +132,7 @@ RSpec.describe "bundle check" do gem "rack" G - bundle "check", :raise_on_error => false + bundle "check", raise_on_error: false expect(err).to include("* rack (1.0.0)") expect(exitstatus).to eq(1) end @@ -146,9 +146,9 @@ RSpec.describe "bundle check" do bundle "config set --local path vendor/bundle" bundle :cache - gem_command "uninstall rack", :env => { "GEM_HOME" => vendored_gems.to_s } + gem_command "uninstall rack", env: { "GEM_HOME" => vendored_gems.to_s } - bundle "check", :raise_on_error => false + bundle "check", raise_on_error: false expect(err).to include("* rack (1.0.0)") expect(exitstatus).to eq(1) end @@ -162,7 +162,7 @@ RSpec.describe "bundle check" do end G - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path lockfile <<-G GEM @@ -193,7 +193,7 @@ RSpec.describe "bundle check" do end G - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path lockfile <<-G GEM @@ -216,13 +216,13 @@ RSpec.describe "bundle check" do end it "outputs an error when the default Gemfile is not found" do - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(exitstatus).to eq(10) expect(err).to include("Could not locate Gemfile") end it "does not output fatal error message" do - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(exitstatus).to eq(10) expect(err).not_to include("Unfortunately, a fatal error has occurred. ") end @@ -237,11 +237,11 @@ RSpec.describe "bundle check" do bundle "install" FileUtils.rm(bundled_app_lock) - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(last_command).to be_failure end - context "--path", :bundler => "< 3" do + context "--path", bundler: "< 3" do context "after installing gems in the proper directory" do before do gemfile <<-G @@ -271,7 +271,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle "check --path vendor/bundle", :raise_on_error => false + bundle "check --path vendor/bundle", raise_on_error: false end it "returns false" do @@ -298,7 +298,7 @@ RSpec.describe "bundle check" do it "shows what is missing with the current Gemfile if it is not satisfied" do simulate_new_machine - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) expect(err).to include("* rack (1.0") end @@ -326,7 +326,7 @@ RSpec.describe "bundle check" do end it "shows what is missing with the current Gemfile without duplications" do - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) expect(err).to include("* rack (1.0").once end @@ -362,7 +362,7 @@ RSpec.describe "bundle check" do end it "shows what is missing with the current Gemfile without duplications" do - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false expect(err).to match(/The following gems are missing/) expect(err).to include("* rack (1.0").once end @@ -379,7 +379,7 @@ RSpec.describe "bundle check" do end it "returns success when the Gemfile is satisfied" do - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path bundle :check expect(out).to include("The Gemfile's dependencies are satisfied") end @@ -404,7 +404,7 @@ RSpec.describe "bundle check" do end it "returns success when the Gemfile is satisfied and generates a correct lockfile" do - system_gems "depends_on_rack-1.0", "rack-1.0", :gem_repo => gem_repo4, :path => default_bundle_path + system_gems "depends_on_rack-1.0", "rack-1.0", gem_repo: gem_repo4, path: default_bundle_path bundle :check checksums = checksums_section_when_existing do |c| @@ -447,7 +447,7 @@ RSpec.describe "bundle check" do build_gem "dex-dispatch-engine" end - build_lib("bundle-check-issue", :path => tmp.join("bundle-check-issue")) do |s| + build_lib("bundle-check-issue", path: tmp.join("bundle-check-issue")) do |s| s.write "Gemfile", <<-G source "https://localgemserver.test" @@ -461,14 +461,14 @@ RSpec.describe "bundle check" do s.add_dependency "awesome_print" end - bundle "install", :artifice => "compact_index_extra", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, :dir => tmp.join("bundle-check-issue") + bundle "install", artifice: "compact_index_extra", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, dir: tmp.join("bundle-check-issue") end it "does not corrupt lockfile when changing version" do version_file = tmp.join("bundle-check-issue/bundle-check-issue.gemspec") File.write(version_file, File.read(version_file).gsub(/s\.version = .+/, "s.version = '9999'")) - bundle "check --verbose", :dir => tmp.join("bundle-check-issue") + bundle "check --verbose", dir: tmp.join("bundle-check-issue") checksums = checksums_section_when_existing do |c| c.checksum gem_repo4, "awesome_print", "1.0" diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 29c94029db..b4f7014d5c 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -156,7 +156,7 @@ RSpec.describe "bundle clean" do end it "removes unused git gems" do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") git_path = lib_path("foo") revision = revision_for(git_path) @@ -194,7 +194,7 @@ RSpec.describe "bundle clean" do end it "keeps used git gems even if installed to a symlinked location" do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") git_path = lib_path("foo") revision = revision_for(git_path) @@ -221,7 +221,7 @@ RSpec.describe "bundle clean" do end it "removes old git gems" do - build_git "foo-bar", :path => lib_path("foo-bar") + build_git "foo-bar", path: lib_path("foo-bar") revision = revision_for(lib_path("foo-bar")) gemfile <<-G @@ -236,10 +236,10 @@ RSpec.describe "bundle clean" do bundle "config set path vendor/bundle" bundle "install" - update_git "foo-bar", :path => lib_path("foo-bar") + update_git "foo-bar", path: lib_path("foo-bar") revision2 = revision_for(lib_path("foo-bar")) - bundle "update", :all => true + bundle "update", all: true bundle :clean expect(out).to include("Removing foo-bar (#{revision[0..11]})") @@ -254,8 +254,8 @@ RSpec.describe "bundle clean" do end it "does not remove nested gems in a git repo" do - build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport") - build_git "rails", "3.0", :path => lib_path("rails") do |s| + build_lib "activesupport", "3.0", path: lib_path("rails/activesupport") + build_git "rails", "3.0", path: lib_path("rails") do |s| s.add_dependency "activesupport", "= 3.0" end revision = revision_for(lib_path("rails")) @@ -274,7 +274,7 @@ RSpec.describe "bundle clean" do end it "does not remove git sources that are in without groups" do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") git_path = lib_path("foo") revision = revision_for(git_path) @@ -326,7 +326,7 @@ RSpec.describe "bundle clean" do gem "rack", "1.0.0" G - bundle :clean, :raise_on_error => false + bundle :clean, raise_on_error: false expect(exitstatus).to eq(15) expect(err).to include("--force") @@ -383,7 +383,7 @@ RSpec.describe "bundle clean" do expect(out).to include("rack (1.0.0)").and include("thin (1.0)") end - it "--clean should override the bundle setting on install", :bundler => "< 3" do + it "--clean should override the bundle setting on install", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -405,7 +405,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "thin-1.0" end - it "--clean should override the bundle setting on update", :bundler => "< 3" do + it "--clean should override the bundle setting on update", bundler: "< 3" do build_repo2 gemfile <<-G @@ -421,13 +421,13 @@ RSpec.describe "bundle clean" do build_gem "foo", "1.0.1" end - bundle "update", :all => true + bundle "update", all: true should_have_gems "foo-1.0.1" should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", :bundler => "3" do + it "automatically cleans when path has not been set", bundler: "3" do build_repo2 install_gemfile <<-G @@ -440,7 +440,7 @@ RSpec.describe "bundle clean" do build_gem "foo", "1.0.1" end - bundle "update", :all => true + bundle "update", all: true files = Pathname.glob(bundled_app(".bundle", Bundler.ruby_scope, "*", "*")) files.map! {|f| f.to_s.sub(bundled_app(".bundle", Bundler.ruby_scope).to_s, "") } @@ -486,7 +486,7 @@ RSpec.describe "bundle clean" do build_gem "foo", "1.0.1" end - bundle :update, :all => true + bundle :update, all: true should_have_gems "foo-1.0", "foo-1.0.1" end @@ -505,7 +505,7 @@ RSpec.describe "bundle clean" do update_repo2 do build_gem "foo", "1.0.1" end - bundle :update, :all => true + bundle :update, all: true gem_command :list expect(out).to include("foo (1.0.1, 1.0)") @@ -560,7 +560,7 @@ RSpec.describe "bundle clean" do FileUtils.chmod(0o500, system_cache_path) - bundle :clean, :force => true, :raise_on_error => false + bundle :clean, force: true, raise_on_error: false expect(err).to include(system_gem_path.to_s) expect(err).to include("grant write permissions") @@ -626,13 +626,13 @@ RSpec.describe "bundle clean" do end it "when using --force, it doesn't remove default gem binaries", :realworld do - 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 + 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 - default_irb_version = ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", :raise_on_error => false + default_irb_version = ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", raise_on_error: false skip "irb isn't a default gem" if default_irb_version.empty? # simulate executable for default gem - build_gem "irb", default_irb_version, :to_system => true, :default => true do |s| + build_gem "irb", default_irb_version, to_system: true, default: true do |s| s.executables = "irb" end @@ -642,7 +642,7 @@ RSpec.describe "bundle clean" do source "#{file_uri_for(gem_repo2)}" G - bundle "clean --force", :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + bundle "clean --force", env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } expect(out).not_to include("Removing irb") end @@ -903,7 +903,7 @@ RSpec.describe "bundle clean" do bundle :lock bundle "config set without development" bundle "config set path vendor/bundle" - bundle "install", :verbose => true + bundle "install", verbose: true bundle :clean very_simple_binary_extensions_dir = diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index 99f9423c22..547fd2d869 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -28,7 +28,7 @@ RSpec.describe ".bundle/config" do context "with env overwrite" do it "prints config with env" do - bundle "config list --parseable", :env => { "BUNDLE_FOO" => "bar3" } + bundle "config list --parseable", env: { "BUNDLE_FOO" => "bar3" } expect(out).to include("foo=bar3") end end @@ -64,11 +64,11 @@ RSpec.describe ".bundle/config" do ENV["BUNDLE_APP_CONFIG"] = "../foo" bundle "config set --local path vendor/bundle" - bundle "install", :dir => bundled_app("omg") + bundle "install", dir: bundled_app("omg") expect(bundled_app(".bundle")).not_to exist expect(bundled_app("../foo/config")).to exist - expect(the_bundle).to include_gems "rack 1.0.0", :dir => bundled_app("omg") + expect(the_bundle).to include_gems "rack 1.0.0", dir: bundled_app("omg") end end @@ -96,8 +96,8 @@ RSpec.describe ".bundle/config" do end it "can be configured through BUNDLE_USER_CONFIG" do - bundle "config set path vendor", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config } - bundle "config get path", :env => { "BUNDLE_USER_CONFIG" => bundle_user_config } + bundle "config set path vendor", env: { "BUNDLE_USER_CONFIG" => bundle_user_config } + bundle "config get path", env: { "BUNDLE_USER_CONFIG" => bundle_user_config } expect(out).to include("Set for the current user (#{bundle_user_config}): \"vendor\"") end @@ -105,8 +105,8 @@ RSpec.describe ".bundle/config" do let(:bundle_user_home) { bundled_app(".bundle").to_s } it "uses the right location" do - bundle "config set path vendor", :env => { "BUNDLE_USER_HOME" => bundle_user_home } - bundle "config get path", :env => { "BUNDLE_USER_HOME" => bundle_user_home } + bundle "config set path vendor", env: { "BUNDLE_USER_HOME" => bundle_user_home } + bundle "config get path", env: { "BUNDLE_USER_HOME" => bundle_user_home } expect(out).to include("Set for the current user (#{bundle_user_home}/config): \"vendor\"") end end @@ -461,26 +461,26 @@ E describe "subcommands" do it "list" do - bundle "config list", :env => { "BUNDLE_FOO" => "bar" } + bundle "config list", env: { "BUNDLE_FOO" => "bar" } expect(out).to eq "Settings are listed in order of priority. The top value will be used.\nfoo\nSet via BUNDLE_FOO: \"bar\"" - bundle "config list", :env => { "BUNDLE_FOO" => "bar" }, :parseable => true + bundle "config list", env: { "BUNDLE_FOO" => "bar" }, parseable: true expect(out).to eq "foo=bar" end it "list with credentials" do - bundle "config list", :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" } + bundle "config list", env: { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" } expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"user:[REDACTED]\"" - bundle "config list", :parseable => true, :env => { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" } + bundle "config list", parseable: true, env: { "BUNDLE_GEMS__MYSERVER__COM" => "user:password" } expect(out).to eq "gems.myserver.com=user:password" end it "list with API token credentials" do - bundle "config list", :env => { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" } + bundle "config list", env: { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" } expect(out).to eq "Settings are listed in order of priority. The top value will be used.\ngems.myserver.com\nSet via BUNDLE_GEMS__MYSERVER__COM: \"[REDACTED]:x-oauth-basic\"" - bundle "config list", :parseable => true, :env => { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" } + bundle "config list", parseable: true, env: { "BUNDLE_GEMS__MYSERVER__COM" => "api_token:x-oauth-basic" } expect(out).to eq "gems.myserver.com=api_token:x-oauth-basic" end @@ -515,7 +515,7 @@ E bundle "config set --local foo 4.1" expect(out).to eq "You are replacing the current local value of foo, which is currently \"4\"" - bundle "config set --global --local foo 5", :raise_on_error => false + bundle "config set --global --local foo 5", raise_on_error: false expect(last_command).to be_failure expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time." end @@ -555,7 +555,7 @@ E expect(out).to eq "" expect(bundle("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" - bundle "config unset foo --local --global", :raise_on_error => false + bundle "config unset foo --local --global", raise_on_error: false expect(last_command).to be_failure expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time." end diff --git a/spec/bundler/commands/console_spec.rb b/spec/bundler/commands/console_spec.rb index aa76096e3d..a41432b88a 100644 --- a/spec/bundler/commands/console_spec.rb +++ b/spec/bundler/commands/console_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle console", :bundler => "< 3", :readline => true do +RSpec.describe "bundle console", bundler: "< 3", readline: true do before :each do build_repo2 do # A minimal fake pry console diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 760ab8dc86..0ff137cae3 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle exec" do let(:system_gems_to_install) { %w[rack-1.0.0 rack-0.9.1] } it "works with --gemfile flag" do - system_gems(system_gems_to_install, :path => default_bundle_path) + system_gems(system_gems_to_install, path: default_bundle_path) create_file "CustomGemfile", <<-G source "#{file_uri_for(gem_repo1)}" @@ -16,7 +16,7 @@ RSpec.describe "bundle exec" do end it "activates the correct gem" do - system_gems(system_gems_to_install, :path => default_bundle_path) + system_gems(system_gems_to_install, path: default_bundle_path) gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -28,14 +28,14 @@ RSpec.describe "bundle exec" do end it "works and prints no warnings when HOME is not writable" do - system_gems(system_gems_to_install, :path => default_bundle_path) + system_gems(system_gems_to_install, path: default_bundle_path) gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack", "0.9.1" G - bundle "exec rackup", :env => { "HOME" => "/" } + bundle "exec rackup", env: { "HOME" => "/" } expect(out).to eq("0.9.1") expect(err).to be_empty end @@ -108,7 +108,7 @@ RSpec.describe "bundle exec" do 2.1.4 L - bundle "exec bundle cache", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle "exec bundle cache", env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(out).to include("Updating files in vendor/cache") end @@ -198,7 +198,7 @@ RSpec.describe "bundle exec" do gem "rack", "0.9.1" G - install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2 + install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 source "#{file_uri_for(gem_repo2)}" gem "rack_two", "1.0.0" G @@ -207,12 +207,12 @@ RSpec.describe "bundle exec" do expect(out).to eq("0.9.1") - bundle "exec rackup", :dir => bundled_app2 + bundle "exec rackup", dir: bundled_app2 expect(out).to eq("1.0.0") end context "with default gems" do - let(:default_irb_version) { ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", :raise_on_error => false } + let(:default_irb_version) { ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", raise_on_error: false } context "when not specified in Gemfile" do before do @@ -299,7 +299,7 @@ RSpec.describe "bundle exec" do gem "rack", "0.9.1" G - install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2 + install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 source "#{file_uri_for(gem_repo2)}" gem "rack_two", "1.0.0" G @@ -344,7 +344,7 @@ RSpec.describe "bundle exec" do bundle "exec 'echo $RUBYOPT'" expect(out.split(" ").count(bundler_setup_opt)).to eq(1) - bundle "exec 'echo $RUBYOPT'", :env => { "RUBYOPT" => rubyopt } + bundle "exec 'echo $RUBYOPT'", env: { "RUBYOPT" => rubyopt } expect(out.split(" ").count(bundler_setup_opt)).to eq(1) end @@ -363,7 +363,7 @@ RSpec.describe "bundle exec" do bundle "exec 'echo $RUBYLIB'" expect(out).to include(rubylib) - bundle "exec 'echo $RUBYLIB'", :env => { "RUBYLIB" => rubylib } + bundle "exec 'echo $RUBYLIB'", env: { "RUBYLIB" => rubylib } expect(out).to include(rubylib) end @@ -373,7 +373,7 @@ RSpec.describe "bundle exec" do gem "rack" G - bundle "exec foobarbaz", :raise_on_error => false + bundle "exec foobarbaz", raise_on_error: false expect(exitstatus).to eq(127) expect(err).to include("bundler: command not found: foobarbaz") expect(err).to include("Install missing gem executables with `bundle install`") @@ -386,7 +386,7 @@ RSpec.describe "bundle exec" do G bundle "exec touch foo" - bundle "exec ./foo", :raise_on_error => false + bundle "exec ./foo", raise_on_error: false expect(exitstatus).to eq(126) expect(err).to include("bundler: not executable: ./foo") end @@ -397,13 +397,13 @@ RSpec.describe "bundle exec" do gem "rack" G - bundle "exec", :raise_on_error => false + bundle "exec", raise_on_error: false expect(exitstatus).to eq(128) expect(err).to include("bundler: exec needs a command to run") end it "raises a helpful error when exec'ing to something outside of the bundle" do - system_gems(system_gems_to_install, :path => default_bundle_path) + system_gems(system_gems_to_install, path: default_bundle_path) bundle "config set clean false" # want to keep the rackup binstub install_gemfile <<-G @@ -412,7 +412,7 @@ RSpec.describe "bundle exec" do G [true, false].each do |l| bundle "config set disable_exec_load #{l}" - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false expect(err).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" end end @@ -531,7 +531,7 @@ RSpec.describe "bundle exec" do describe "from gems bundled via :path" do before(:each) do - build_lib "fizz", :path => home("fizz") do |s| + build_lib "fizz", path: home("fizz") do |s| s.executables = "fizz" end @@ -580,7 +580,7 @@ RSpec.describe "bundle exec" do describe "from gems bundled via :git with no gemspec" do before(:each) do - build_git "fizz_no_gemspec", :gemspec => false do |s| + build_git "fizz_no_gemspec", gemspec: false do |s| s.executables = "fizz_no_gemspec" end @@ -647,7 +647,7 @@ RSpec.describe "bundle exec" do build_gem "optparse", "999.999.999" end - system_gems "optparse-999.999.998", :gem_repo => gem_repo4 + system_gems "optparse-999.999.998", gem_repo: gem_repo4 bundle "config set auto_install 1" bundle "config set --local path vendor/bundle" @@ -683,7 +683,7 @@ RSpec.describe "bundle exec" do gem "foo", :path => "#{lib_path("foo-1.0")}" G - bundle "exec irb", :raise_on_error => false + bundle "exec irb", raise_on_error: false expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid") expect(err).to match('"TODO" is not a summary') @@ -706,7 +706,7 @@ RSpec.describe "bundle exec" do G bundle "config set path.system true" bundle "install" - bundle "exec ruby -e '`bundle -v`; puts $?.success?'", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle "exec ruby -e '`bundle -v`; puts $?.success?'", env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(out).to match("true") end end @@ -726,7 +726,7 @@ RSpec.describe "bundle exec" do RUBY before do - system_gems(system_gems_to_install, :path => default_bundle_path) + system_gems(system_gems_to_install, path: default_bundle_path) bundled_app(path).open("w") {|f| f << executable } bundled_app(path).chmod(0o755) @@ -749,7 +749,7 @@ RSpec.describe "bundle exec" do let(:expected) { [exec, args, rack, process].join("\n") } let(:expected_err) { "" } - subject { bundle "exec #{path} arg1 arg2", :raise_on_error => false } + subject { bundle "exec #{path} arg1 arg2", raise_on_error: false } it "runs" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? @@ -874,7 +874,7 @@ RSpec.describe "bundle exec" do end end - context "when Bundler.setup fails", :bundler => "< 3" do + context "when Bundler.setup fails", bundler: "< 3" do before do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -904,7 +904,7 @@ Run `bundle install` to install missing gems. end end - context "when Bundler.setup fails", :bundler => "3" do + context "when Bundler.setup fails", bundler: "3" do before do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1113,7 +1113,7 @@ __FILE__: #{path.to_s.inspect} puts `bundle exec echo foo` RUBY file.chmod(0o777) - bundle "exec #{file}", :env => { "PATH" => path } + bundle "exec #{file}", env: { "PATH" => path } expect(out).to eq("foo") end end @@ -1206,7 +1206,7 @@ __FILE__: #{path.to_s.inspect} context "with a system gem that shadows a default gem" do let(:openssl_version) { "99.9.9" } - let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil, :raise_on_error => false } + let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", artifice: nil, raise_on_error: false } it "only leaves the default gem in the stdlib available" do skip "https://github.com/rubygems/rubygems/issues/3351" if Gem.win_platform? @@ -1222,7 +1222,7 @@ __FILE__: #{path.to_s.inspect} end end - system_gems("openssl-#{openssl_version}", :gem_repo => gem_repo4) + system_gems("openssl-#{openssl_version}", gem_repo: gem_repo4) file = bundled_app("require_openssl.rb") create_file(file, <<-RUBY) @@ -1235,15 +1235,15 @@ __FILE__: #{path.to_s.inspect} env = { "PATH" => path } aggregate_failures do - expect(bundle("exec #{file}", :artifice => nil, :env => env)).to eq(expected) - expect(bundle("exec bundle exec #{file}", :artifice => nil, :env => env)).to eq(expected) - expect(bundle("exec ruby #{file}", :artifice => nil, :env => env)).to eq(expected) - expect(run(file.read, :artifice => nil, :env => env)).to eq(expected) + expect(bundle("exec #{file}", artifice: nil, env: env)).to eq(expected) + expect(bundle("exec bundle exec #{file}", artifice: nil, env: env)).to eq(expected) + expect(bundle("exec ruby #{file}", artifice: nil, env: env)).to eq(expected) + expect(run(file.read, artifice: nil, env: env)).to eq(expected) end skip "ruby_core has openssl and rubygems in the same folder, and this test needs rubygems require but default openssl not in a directly added entry in $LOAD_PATH" if ruby_core? # sanity check that we get the newer, custom version without bundler - sys_exec "#{Gem.ruby} #{file}", :env => env, :raise_on_error => false + sys_exec "#{Gem.ruby} #{file}", env: env, raise_on_error: false expect(err).to include("custom openssl should not be loaded") end end diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb index 409c49f9e1..535df8e35a 100644 --- a/spec/bundler/commands/help_spec.rb +++ b/spec/bundler/commands/help_spec.rb @@ -71,7 +71,7 @@ RSpec.describe "bundle help" do it "has helpful output when using --help flag for a non-existent command" do with_fake_man do - bundle "instill -h", :raise_on_error => false + bundle "instill -h", raise_on_error: false end expect(err).to include('Could not find command "instill".') end diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb index 851f50240f..3d8cbad0d6 100644 --- a/spec/bundler/commands/info_spec.rb +++ b/spec/bundler/commands/info_spec.rb @@ -65,7 +65,7 @@ RSpec.describe "bundle info" do end it "complains if gem not in bundle" do - bundle "info missing", :raise_on_error => false + bundle "info missing", raise_on_error: false expect(err).to eq("Could not find gem 'missing'.") end @@ -167,7 +167,7 @@ RSpec.describe "bundle info" do end it "prints out branch names other than main" do - update_git "foo", :branch => "omg" do |s| + update_git "foo", branch: "omg" do |s| s.write "lib/foo.rb", "FOO = '1.0.omg'" end @revision = revision_for(lib_path("foo-1.0"))[0...6] @@ -194,7 +194,7 @@ RSpec.describe "bundle info" do end it "handles when a version is a '-' prerelease" do - @git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo")) + @git = build_git("foo", "1.0.0-beta.1", path: lib_path("foo")) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}" @@ -228,7 +228,7 @@ RSpec.describe "bundle info" do invalid_regexp = "[]" - bundle "info #{invalid_regexp}", :raise_on_error => false + bundle "info #{invalid_regexp}", raise_on_error: false expect(err).to include("Could not find gem '#{invalid_regexp}'.") end end @@ -242,7 +242,7 @@ RSpec.describe "bundle info" do gem "rails", group: :test G - bundle "info rails", :raise_on_error => false + bundle "info rails", raise_on_error: false expect(err).to include("Could not find gem 'rails', because it's in the group 'test', configured to be ignored.") end end diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb index 6aa3e9edd1..0a1336572a 100644 --- a/spec/bundler/commands/init_spec.rb +++ b/spec/bundler/commands/init_spec.rb @@ -24,7 +24,7 @@ RSpec.describe "bundle init" do it "honours the current process umask when generating from a template" do FileUtils.mkdir(target_dir) - bundle :init, :dir => target_dir + bundle :init, dir: target_dir generated_mode = File.stat(File.join(target_dir, "Gemfile")).mode & 0o111 expect(generated_mode).to be_zero end @@ -38,11 +38,11 @@ RSpec.describe "bundle init" do end it "does not change existing Gemfiles" do - expect { bundle :init, :raise_on_error => false }.not_to change { File.read(bundled_app_gemfile) } + expect { bundle :init, raise_on_error: false }.not_to change { File.read(bundled_app_gemfile) } end it "notifies the user that an existing Gemfile already exists" do - bundle :init, :raise_on_error => false + bundle :init, raise_on_error: false expect(err).to include("Gemfile already exists") end end @@ -55,7 +55,7 @@ RSpec.describe "bundle init" do FileUtils.mkdir bundled_app(subdir) - bundle :init, :dir => bundled_app(subdir) + bundle :init, dir: bundled_app(subdir) expect(out).to include("Writing new Gemfile") expect(bundled_app("#{subdir}/Gemfile")).to be_file @@ -71,7 +71,7 @@ RSpec.describe "bundle init" do mode = File.stat(bundled_app(subdir)).mode ^ 0o222 FileUtils.chmod mode, bundled_app(subdir) - bundle :init, :dir => bundled_app(subdir), :raise_on_error => false + bundle :init, dir: bundled_app(subdir), raise_on_error: false expect(err).to include("directory is not writable") expect(Dir[bundled_app("#{subdir}/*")]).to be_empty @@ -92,7 +92,7 @@ RSpec.describe "bundle init" do S end - bundle :init, :gemspec => spec_file + bundle :init, gemspec: spec_file gemfile = bundled_app_gemfile.read expect(gemfile).to match(%r{source 'https://rubygems.org'}) @@ -112,7 +112,7 @@ RSpec.describe "bundle init" do S end - bundle :init, :gemspec => spec_file, :raise_on_error => false + bundle :init, gemspec: spec_file, raise_on_error: false expect(err).to include("There was an error while loading `test.gemspec`") end end @@ -135,11 +135,11 @@ RSpec.describe "bundle init" do end it "does not change existing Gemfiles" do - expect { bundle :init, :raise_on_error => false }.not_to change { File.read(bundled_app("gems.rb")) } + expect { bundle :init, raise_on_error: false }.not_to change { File.read(bundled_app("gems.rb")) } end it "notifies the user that an existing gems.rb already exists" do - bundle :init, :raise_on_error => false + bundle :init, raise_on_error: false expect(err).to include("gems.rb already exists") end end @@ -152,7 +152,7 @@ RSpec.describe "bundle init" do FileUtils.mkdir bundled_app(subdir) - bundle :init, :dir => bundled_app(subdir) + bundle :init, dir: bundled_app(subdir) expect(out).to include("Writing new gems.rb") expect(bundled_app("#{subdir}/gems.rb")).to be_file @@ -175,7 +175,7 @@ RSpec.describe "bundle init" do end it "should generate from an existing gemspec" do - bundle :init, :gemspec => spec_file + bundle :init, gemspec: spec_file gemfile = bundled_app("gems.rb").read expect(gemfile).to match(%r{source 'https://rubygems.org'}) @@ -185,7 +185,7 @@ RSpec.describe "bundle init" do end it "prints message to user" do - bundle :init, :gemspec => spec_file + bundle :init, gemspec: spec_file expect(out).to include("Writing new gems.rb") end @@ -196,7 +196,7 @@ RSpec.describe "bundle init" do it "should use the --gemfile value to name the gemfile" do custom_gemfile_name = "NiceGemfileName" - bundle :init, :gemfile => custom_gemfile_name + bundle :init, gemfile: custom_gemfile_name expect(out).to include("Writing new #{custom_gemfile_name}") used_template = File.read("#{source_root}/lib/bundler/templates/Gemfile") diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index d711fe010d..255a03c135 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle inject", :bundler => "< 3" do +RSpec.describe "bundle inject", bundler: "< 3" do before :each do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -36,14 +36,14 @@ RSpec.describe "bundle inject", :bundler => "< 3" do context "with injected gems already in the Gemfile" do it "doesn't add existing gems" do - bundle "inject 'rack' '> 0'", :raise_on_error => false + bundle "inject 'rack' '> 0'", raise_on_error: false expect(err).to match(/cannot specify the same gem twice/i) end end context "incorrect arguments" do it "fails when more than 2 arguments are passed" do - bundle "inject gem_name 1 v", :raise_on_error => false + bundle "inject gem_name 1 v", raise_on_error: false expect(err).to eq(<<-E.strip) ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"] Usage: "bundle inject GEM VERSION" @@ -108,7 +108,7 @@ Usage: "bundle inject GEM VERSION" source "#{file_uri_for(gem_repo1)}" gem "rack-obama" G - bundle "inject 'rack' '> 0'", :raise_on_error => false + bundle "inject 'rack' '> 0'", raise_on_error: false expect(err).to match(/the lockfile can't be updated because frozen mode is set/) expect(bundled_app_lock.read).not_to match(/rack-obama/) diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 66b618c2b1..5f5c9bb286 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "bundle install with gem sources" do end it "does not make a lockfile if the install fails" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false raise StandardError, "FAIL" G @@ -29,7 +29,7 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app_lock).to exist end - it "does not create ./.bundle by default", :bundler => "< 3" do + it "does not create ./.bundle by default", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -45,7 +45,7 @@ RSpec.describe "bundle install with gem sources" do gem "rack" G - bundle :install, :env => { "BUNDLE_PATH__SYSTEM" => "true" } # can't use install_gemfile since it sets retry + bundle :install, env: { "BUNDLE_PATH__SYSTEM" => "true" } # can't use install_gemfile since it sets retry expect(bundled_app(".bundle")).not_to exist end @@ -68,7 +68,7 @@ RSpec.describe "bundle install with gem sources" do lockfile = File.read(bundled_app_lock) - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false raise StandardError, "FAIL" G @@ -130,7 +130,7 @@ RSpec.describe "bundle install with gem sources" do end it "raises an appropriate error when gems are specified using symbols" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem :rack G @@ -197,7 +197,7 @@ RSpec.describe "bundle install with gem sources" do end it "does not reinstall any gem that is already available locally" do - system_gems "activesupport-2.3.2", :path => default_bundle_path + system_gems "activesupport-2.3.2", path: default_bundle_path build_repo2 do build_gem "activesupport", "2.3.2" do |s| @@ -214,7 +214,7 @@ RSpec.describe "bundle install with gem sources" do end it "works when the gemfile specifies gems that only exist in the system" do - build_gem "foo", :to_bundle => true + build_gem "foo", to_bundle: true install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -225,7 +225,7 @@ RSpec.describe "bundle install with gem sources" do end it "prioritizes local gems over remote gems" do - build_gem "rack", "1.0.0", :to_bundle => true do |s| + build_gem "rack", "1.0.0", to_bundle: true do |s| s.add_dependency "activesupport", "2.3.5" end @@ -241,7 +241,7 @@ RSpec.describe "bundle install with gem sources" do plugin_msg = "hello from an env plugin!" create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'" rubylib = ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR).unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR) - install_gemfile <<-G, :env => { "RUBYLIB" => rubylib } + install_gemfile <<-G, env: { "RUBYLIB" => rubylib } source "#{file_uri_for(gem_repo1)}" gem "rack" G @@ -311,14 +311,14 @@ RSpec.describe "bundle install with gem sources" do expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system without deleting foo", :bundler => "< 3" do + it "allows running bundle install --system without deleting foo", bundler: "< 3" do bundle "install --path vendor" bundle "install --system" FileUtils.rm_rf(bundled_app("vendor")) expect(the_bundle).to include_gems "rack 1.0" end - it "allows running bundle install --system after deleting foo", :bundler => "< 3" do + it "allows running bundle install --system after deleting foo", bundler: "< 3" do bundle "install --path vendor" FileUtils.rm_rf(bundled_app("vendor")) bundle "install --system" @@ -326,7 +326,7 @@ RSpec.describe "bundle install with gem sources" do end end - it "finds gems in multiple sources", :bundler => "< 3" do + it "finds gems in multiple sources", bundler: "< 3" do build_repo2 do build_gem "rack", "1.2" do |s| s.executables = "rackup" @@ -345,7 +345,7 @@ RSpec.describe "bundle install with gem sources" do end it "gives a useful error if no sources are set" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false gem "rack" G @@ -408,7 +408,7 @@ RSpec.describe "bundle install with gem sources" do end it "does not throw a warning if a gem is added once in Gemfile and also inside a gemspec as a development dependency" do - build_lib "my-gem", :path => bundled_app do |s| + build_lib "my-gem", path: bundled_app do |s| s.add_development_dependency "my-private-gem" end @@ -431,7 +431,7 @@ RSpec.describe "bundle install with gem sources" do end it "throws a warning if a gem is added once in Gemfile and also inside a gemspec as a development dependency, with different requirements" do - build_lib "my-gem", :path => bundled_app do |s| + build_lib "my-gem", path: bundled_app do |s| s.add_development_dependency "rubocop", "~> 1.36.0" end @@ -461,7 +461,7 @@ RSpec.describe "bundle install with gem sources" do end it "does not warn if a gem is added once in Gemfile and also inside a gemspec as a development dependency, with same requirements, and different sources" do - build_lib "my-gem", :path => bundled_app do |s| + build_lib "my-gem", path: bundled_app do |s| s.add_development_dependency "activesupport" end @@ -469,7 +469,7 @@ RSpec.describe "bundle install with gem sources" do build_gem "activesupport" end - build_git "activesupport", "1.0", :path => lib_path("activesupport") + build_git "activesupport", "1.0", path: lib_path("activesupport") install_gemfile <<~G source "#{file_uri_for(gem_repo4)}" @@ -480,7 +480,7 @@ RSpec.describe "bundle install with gem sources" do G expect(err).to be_empty - expect(the_bundle).to include_gems "activesupport 1.0", :source => "git@#{lib_path("activesupport")}" + expect(the_bundle).to include_gems "activesupport 1.0", source: "git@#{lib_path("activesupport")}" # if the Gemfile dependency is specified first install_gemfile <<~G @@ -492,11 +492,11 @@ RSpec.describe "bundle install with gem sources" do G expect(err).to be_empty - expect(the_bundle).to include_gems "activesupport 1.0", :source => "git@#{lib_path("activesupport")}" + expect(the_bundle).to include_gems "activesupport 1.0", source: "git@#{lib_path("activesupport")}" end it "considers both dependencies for resolution if a gem is added once in Gemfile and also inside a local gemspec as a runtime dependency, with different requirements" do - build_lib "my-gem", :path => bundled_app do |s| + build_lib "my-gem", path: bundled_app do |s| s.add_dependency "rubocop", "~> 1.36.0" end @@ -520,7 +520,7 @@ RSpec.describe "bundle install with gem sources" do end it "throws an error if a gem is added twice in Gemfile when version of one dependency is not specified" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rack" gem "rack", "1.0" @@ -531,7 +531,7 @@ RSpec.describe "bundle install with gem sources" do end it "throws an error if a gem is added twice in Gemfile when different versions of both dependencies are specified" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rack", "1.0" gem "rack", "1.1" @@ -544,7 +544,7 @@ RSpec.describe "bundle install with gem sources" do it "gracefully handles error when rubygems server is unavailable" do skip "networking issue" if Gem.win_platform? - install_gemfile <<-G, :artifice => nil, :raise_on_error => false + install_gemfile <<-G, artifice: nil, raise_on_error: false source "#{file_uri_for(gem_repo1)}" source "http://0.0.0.0:9384" do gem 'foo' @@ -557,7 +557,7 @@ RSpec.describe "bundle install with gem sources" do it "fails gracefully when downloading an invalid specification from the full index" do build_repo2 do - build_gem "ajp-rails", "0.0.0", :gemspec => false, :skip_validation => true do |s| + build_gem "ajp-rails", "0.0.0", gemspec: false, skip_validation: true do |s| bad_deps = [["ruby-ajp", ">= 0.2.0"], ["rails", ">= 0.14"]] s. instance_variable_get(:@spec). @@ -568,7 +568,7 @@ RSpec.describe "bundle install with gem sources" do build_gem "ruby-ajp", "1.0.0" end - install_gemfile <<-G, :full_index => true, :raise_on_error => false + install_gemfile <<-G, full_index: true, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "ajp-rails", "0.0.0" @@ -605,7 +605,7 @@ RSpec.describe "bundle install with gem sources" do describe "Ruby version in Gemfile.lock" do context "and using an unsupported Ruby version" do it "prints an error" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false ruby '~> 1.2' source "#{file_uri_for(gem_repo1)}" G @@ -695,7 +695,7 @@ RSpec.describe "bundle install with gem sources" do file.puts gemfile end - bundle :install, :dir => root_dir + bundle :install, dir: root_dir end it "doesn't blow up when using the `gemspec` DSL" do @@ -703,7 +703,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.mkdir_p(root_dir) - build_lib "foo", :path => root_dir + build_lib "foo", path: root_dir gemfile = <<-G source "#{file_uri_for(gem_repo1)}" gemspec @@ -712,7 +712,7 @@ RSpec.describe "bundle install with gem sources" do file.puts gemfile end - bundle :install, :dir => root_dir + bundle :install, dir: root_dir end end @@ -725,7 +725,7 @@ RSpec.describe "bundle install with gem sources" do gem 'rack' G - bundle :install, :quiet => true + bundle :install, quiet: true expect(out).to be_empty expect(err).to be_empty end @@ -755,7 +755,7 @@ RSpec.describe "bundle install with gem sources" do gem 'non-existing-gem' G - bundle :install, :quiet => true, :raise_on_error => false, :env => { "RUBYOPT" => "-r#{bundled_app("install_with_warning.rb")}" } + bundle :install, quiet: true, raise_on_error: false, env: { "RUBYOPT" => "-r#{bundled_app("install_with_warning.rb")}" } expect(out).to be_empty expect(err).to include("Could not find gem 'non-existing-gem'") expect(err).to include("BOOOOO") @@ -777,7 +777,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.chmod(0o500, bundle_path) bundle "config set --local path vendor" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include(bundle_path.to_s) expect(err).to include("grant write permissions") end @@ -799,7 +799,7 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local path vendor" begin - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false ensure FileUtils.chmod("+x", gems_path) end @@ -829,7 +829,7 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local path vendor" begin - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false ensure FileUtils.chmod("+x", extensions_path) end @@ -869,7 +869,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.chmod("-x", foo_path) begin - bundle "install --redownload", :raise_on_error => false + bundle "install --redownload", raise_on_error: false ensure FileUtils.chmod("+x", foo_path) end @@ -939,7 +939,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.chmod(0o777, gems_path) - bundle "install --redownload", :raise_on_error => false + bundle "install --redownload", raise_on_error: false expect(err).to include("The installation path is insecure. Bundler cannot continue.") end @@ -960,7 +960,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.chmod(0o500, cache_path) bundle "config set --local path vendor" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include(cache_path.to_s) expect(err).to include("grant write permissions") end @@ -973,11 +973,11 @@ RSpec.describe "bundle install with gem sources" do gem "rack" G bundle "config set --local path bundle" - bundle "install", :standalone => true + bundle "install", standalone: true end it "includes the standalone path" do - bundle "binstubs rack", :standalone => true + bundle "binstubs rack", standalone: true standalone_line = File.read(bundled_app("bin/rackup")).each_line.find {|line| line.include? "$:.unshift" }.strip expect(standalone_line).to eq %($:.unshift File.expand_path "../bundle", __dir__) end @@ -992,7 +992,7 @@ RSpec.describe "bundle install with gem sources" do end it "should display a helpful message explaining how to fix it" do - bundle :install, :env => { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" }, :raise_on_error => false + bundle :install, env: { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" }, raise_on_error: false expect(exitstatus).to eq(17) expect(err).to eq("Please CGI escape your usernames and passwords before " \ "setting them for authentication.") @@ -1033,7 +1033,7 @@ RSpec.describe "bundle install with gem sources" do end it "should fail loudly if the lockfile platforms don't include the current platform" do - simulate_platform(Gem::Platform.new("x86_64-linux")) { bundle "install", :raise_on_error => false } + simulate_platform(Gem::Platform.new("x86_64-linux")) { bundle "install", raise_on_error: false } expect(err).to eq( "Your bundle only supports platforms [\"x86_64-darwin-19\"] but your local platform is x86_64-linux. " \ @@ -1111,7 +1111,7 @@ RSpec.describe "bundle install with gem sources" do bundle "config set --local path vendor/bundle" simulate_platform "x86_64-linux" do - bundle "install", :artifice => "compact_index" + bundle "install", artifice: "compact_index" end checksums = checksums_section_when_existing do |c| @@ -1154,11 +1154,11 @@ RSpec.describe "bundle install with gem sources" do context "with --local flag" do before do - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path end it "respects installed gems without fetching any remote sources" do - install_gemfile <<-G, :local => true + install_gemfile <<-G, local: true source "#{file_uri_for(gem_repo1)}" source "https://not-existing-source" do @@ -1198,11 +1198,11 @@ RSpec.describe "bundle install with gem sources" do build_gem "bar", "1.0.0" end - system_gems "foo-1.0.0", :path => default_bundle_path, :gem_repo => gem_repo4 + 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 + install_gemfile <<-G, "prefer-local": true, verbose: true source "#{file_uri_for(gem_repo4)}" gem "foo" @@ -1232,7 +1232,7 @@ RSpec.describe "bundle install with gem sources" do File.symlink("../../README.markdown", File.join(man_path, "README.markdown")) build_repo4 do - build_gem "binman", :path => gem_repo4("gems"), :lib_path => binman_path, :no_default => true do |s| + build_gem "binman", path: gem_repo4("gems"), lib_path: binman_path, no_default: true do |s| s.files = ["README.markdown", "man/man0/README.markdown"] end end @@ -1267,7 +1267,7 @@ RSpec.describe "bundle install with gem sources" do gem "autobuild", "1.10.rc2" G - bundle "install --jobs 1", :raise_on_error => false + bundle "install --jobs 1", raise_on_error: false expect(err).not_to include("ERROR REPORT TEMPLATE") expect(err).to include("Could not find compatible versions") @@ -1312,14 +1312,14 @@ RSpec.describe "bundle install with gem sources" do end it "does not install, but raises a resolution error" do - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to include("Could not find compatible versions") end end context "when --jobs option given" do before do - install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", :jobs => 1 + install_gemfile "source \"#{file_uri_for(gem_repo1)}\"", jobs: 1 end it "does not save the flag to config" do diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index 66930ded75..5ac2077d81 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle list" do context "with name-only and paths option" do it "raises an error" do - bundle "list --name-only --paths", :raise_on_error => false + bundle "list --name-only --paths", raise_on_error: false expect(err).to eq "The `--name-only` and `--paths` options cannot be used together" end @@ -11,7 +11,7 @@ RSpec.describe "bundle list" do context "with without-group and only-group option" do it "raises an error" do - bundle "list --without-group dev --only-group test", :raise_on_error => false + bundle "list --without-group dev --only-group test", raise_on_error: false expect(err).to eq "The `--only-group` and `--without-group` options cannot be used together" end @@ -40,7 +40,7 @@ RSpec.describe "bundle list" do context "when group is not found" do it "raises an error" do - bundle "list --without-group random", :raise_on_error => false + bundle "list --without-group random", raise_on_error: false expect(err).to eq "`random` group could not be found." end @@ -79,7 +79,7 @@ RSpec.describe "bundle list" do context "when group is not found" do it "raises an error" do - bundle "list --only-group random", :raise_on_error => false + bundle "list --only-group random", raise_on_error: false expect(err).to eq "`random` group could not be found." end @@ -124,9 +124,9 @@ RSpec.describe "bundle list" do build_gem "bar" end - build_git "git_test", "1.0.0", :path => lib_path("git_test") + build_git "git_test", "1.0.0", path: lib_path("git_test") - build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s| + build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s| s.add_dependency "bar", "=1.0.0" end diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index e4d44f09f5..cf34dc641c 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -114,13 +114,13 @@ RSpec.describe "bundle lock" do it "writes a lockfile when there is an outdated lockfile and bundle is frozen" do lockfile @lockfile.gsub("2.3.2", "2.3.1") - bundle "lock --update", :env => { "BUNDLE_FROZEN" => "true" } + bundle "lock --update", env: { "BUNDLE_FROZEN" => "true" } expect(read_lockfile).to eq(@lockfile) end it "does not fetch remote specs when using the --local option" do - bundle "lock --update --local", :raise_on_error => false + bundle "lock --update --local", raise_on_error: false expect(err).to match(/locally installed gems/) end @@ -255,7 +255,7 @@ RSpec.describe "bundle lock" do G # Change uri format to end with "/" and reinstall - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}/" G @@ -305,7 +305,7 @@ RSpec.describe "bundle lock" do it "errors when updating a missing specific gems using --update" do lockfile @lockfile - bundle "lock --update blahblah", :raise_on_error => false + bundle "lock --update blahblah", raise_on_error: false expect(err).to eq("Could not find gem 'blahblah'.") expect(read_lockfile).to eq(@lockfile) @@ -320,7 +320,7 @@ RSpec.describe "bundle lock" do G bundle "config set without test" bundle "config set path vendor/bundle" - bundle "lock", :verbose => true + bundle "lock", verbose: true expect(bundled_app("vendor/bundle")).not_to exist end @@ -449,21 +449,21 @@ RSpec.describe "bundle lock" do build_gem "bundler", "55" end - system_gems "bundler-55", :gem_repo => gem_repo4 + system_gems "bundler-55", gem_repo: gem_repo4 - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "https://gems.repo4" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2') - bundle "lock --update --bundler --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "lock --update --bundler --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } expect(lockfile).to end_with("BUNDLED WITH\n 55\n") update_repo4 do build_gem "bundler", "99" end - bundle "lock --update --bundler --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "lock --update --bundler --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } expect(lockfile).to end_with("BUNDLED WITH\n 99\n") end @@ -588,7 +588,7 @@ RSpec.describe "bundle lock" do end it "errors when removing all platforms" do - bundle "lock --remove-platform #{local_platform}", :raise_on_error => false + bundle "lock --remove-platform #{local_platform}", raise_on_error: false expect(err).to include("Removing all platforms from the bundle is not allowed") end @@ -875,7 +875,7 @@ RSpec.describe "bundle lock" do #{Bundler::VERSION} L - bundle "lock --add-platform x86_64-linux", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "lock --add-platform x86_64-linux", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } end it "does not crash on conflicting ruby requirements between platform versions in two different gems" do @@ -931,7 +931,7 @@ RSpec.describe "bundle lock" do #{Bundler::VERSION} L - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "DEBUG_RESOLVER" => "1" } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "DEBUG_RESOLVER" => "1" } end it "respects lower bound ruby requirements" do @@ -963,7 +963,7 @@ RSpec.describe "bundle lock" 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 } end context "when an update is available" do @@ -1096,8 +1096,8 @@ RSpec.describe "bundle lock" do build_gem "irb", "1.5.0" end - system_gems "irb-1.5.0", :gem_repo => gem_repo4 - system_gems "debug-1.6.3", :gem_repo => gem_repo4 + system_gems "irb-1.5.0", gem_repo: gem_repo4 + system_gems "debug-1.6.3", gem_repo: gem_repo4 # simulate gemspec with wrong empty dependencies debug_gemspec_path = system_gem_path("specifications/debug-1.6.3.gemspec") @@ -1187,7 +1187,7 @@ RSpec.describe "bundle lock" do gem "activeadmin", "2.13.1" G - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false expect(err).to eq <<~ERR.strip Could not find compatible versions @@ -1262,7 +1262,7 @@ RSpec.describe "bundle lock" do #{Bundler::VERSION} L - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false expect(err).to eq <<~ERR.strip Could not find compatible versions @@ -1290,7 +1290,7 @@ RSpec.describe "bundle lock" do lockfile lockfile.gsub(/PLATFORMS\n #{local_platform}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}") - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false expect(err).to eq <<~ERR.strip Could not find compatible versions @@ -1383,7 +1383,7 @@ RSpec.describe "bundle lock" do G simulate_platform "universal-java-19" do - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false end expect(err).to include("Could not find compatible versions") @@ -1418,7 +1418,7 @@ RSpec.describe "bundle lock" do context "when resolving platform specific gems as indirect dependencies on truffleruby", :truffleruby_only do before do - build_lib "foo", :path => bundled_app do |s| + build_lib "foo", path: bundled_app do |s| s.add_dependency "nokogiri" end diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 310306b21a..cef9c2a646 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -12,14 +12,14 @@ RSpec.describe "bundle gem" do def bundle_exec_rubocop prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) - bundle "config set path #{rubocop_gems}", :dir => bundled_app(gem_name) - bundle "exec rubocop --debug --config .rubocop.yml", :dir => bundled_app(gem_name) + bundle "config set path #{rubocop_gems}", dir: bundled_app(gem_name) + bundle "exec rubocop --debug --config .rubocop.yml", dir: bundled_app(gem_name) end def bundle_exec_standardrb prepare_gemspec(bundled_app(gem_name, "#{gem_name}.gemspec")) - bundle "config set path #{standard_gems}", :dir => bundled_app(gem_name) - bundle "exec standardrb --debug", :dir => bundled_app(gem_name) + bundle "config set path #{standard_gems}", dir: bundled_app(gem_name) + bundle "exec standardrb --debug", dir: bundled_app(gem_name) end let(:generated_gemspec) { Bundler.load_gemspec_uncached(bundled_app(gem_name).join("#{gem_name}.gemspec")) } @@ -63,7 +63,7 @@ RSpec.describe "bundle gem" do end it "properly initializes git repo", :readline do - bundle "gem #{gem_name}", :dir => bundled_app("path with spaces") + bundle "gem #{gem_name}", dir: bundled_app("path with spaces") expect(bundled_app("path with spaces/#{gem_name}/.git")).to exist end end @@ -103,7 +103,7 @@ RSpec.describe "bundle gem" do expect(bundled_app("#{gem_name}/README.md").read).to match(%r{https://github\.com/bundleuser/#{gem_name}/blob/.*/CODE_OF_CONDUCT.md}) end - it "generates the README with a section for the Code of Conduct, respecting the configured git default branch", :git => ">= 2.28.0" do + it "generates the README with a section for the Code of Conduct, respecting the configured git default branch", git: ">= 2.28.0" do sys_exec("git config --global init.defaultBranch main") bundle "gem #{gem_name} --coc" @@ -148,7 +148,7 @@ RSpec.describe "bundle gem" do end shared_examples_for "--rubocop flag" do - context "is deprecated", :bundler => "< 3" do + context "is deprecated", bundler: "< 3" do before do bundle "gem #{gem_name} --rubocop" end @@ -179,7 +179,7 @@ RSpec.describe "bundle gem" do end shared_examples_for "--no-rubocop flag" do - context "is deprecated", :bundler => "< 3" do + context "is deprecated", bundler: "< 3" do define_negated_matcher :exclude, :include before do @@ -435,7 +435,7 @@ RSpec.describe "bundle gem" do load_paths = [lib_dir, spec_dir] load_path_str = "-I#{load_paths.join(File::PATH_SEPARATOR)}" - sys_exec "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", :env => { "PATH" => "" } + sys_exec "#{Gem.ruby} #{load_path_str} #{bindir.join("bundle")} gem #{gem_name}", env: { "PATH" => "" } end it "creates the gem without the need for git" do @@ -457,9 +457,9 @@ RSpec.describe "bundle gem" do prepare_gemspec(bundled_app("newgem", "newgem.gemspec")) gems = ["rake-13.0.1"] - path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(:base => bundled_app("newgem")) : system_gem_path - system_gems gems, :path => path - bundle "exec rake build", :dir => bundled_app("newgem") + path = Bundler.feature_flag.default_install_uses_path? ? local_gem_path(base: bundled_app("newgem")) : system_gem_path + system_gems gems, path: path + bundle "exec rake build", dir: bundled_app("newgem") expect(last_command.stdboth).not_to include("ERROR") end @@ -468,7 +468,7 @@ RSpec.describe "bundle gem" do it "resolves ." do create_temporary_dir("tmp") - bundle "gem .", :dir => bundled_app("tmp") + bundle "gem .", dir: bundled_app("tmp") expect(bundled_app("tmp/lib/tmp.rb")).to exist end @@ -476,7 +476,7 @@ RSpec.describe "bundle gem" do it "resolves .." do create_temporary_dir("temp/empty_dir") - bundle "gem ..", :dir => bundled_app("temp/empty_dir") + bundle "gem ..", dir: bundled_app("temp/empty_dir") expect(bundled_app("temp/lib/temp.rb")).to exist end @@ -484,7 +484,7 @@ RSpec.describe "bundle gem" do it "resolves relative directory" do create_temporary_dir("tmp/empty/tmp") - bundle "gem ../../empty", :dir => bundled_app("tmp/empty/tmp") + bundle "gem ../../empty", dir: bundled_app("tmp/empty/tmp") expect(bundled_app("tmp/empty/lib/empty.rb")).to exist end @@ -660,7 +660,7 @@ RSpec.describe "bundle gem" do file.puts rakefile end - sys_exec(rake, :dir => bundled_app(gem_name)) + sys_exec(rake, dir: bundled_app(gem_name)) expect(out).to include("SUCCESS") end @@ -938,7 +938,7 @@ RSpec.describe "bundle gem" do context "--ci set to travis" do it "generates a GitHub Actions config file" do - bundle "gem #{gem_name} --ci=travis", :raise_on_error => false + bundle "gem #{gem_name} --ci=travis", raise_on_error: false expect(err).to include("Support for Travis CI was removed from gem skeleton generator.") expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist @@ -947,7 +947,7 @@ RSpec.describe "bundle gem" do context "--ci set to travis" do it "generates a GitHub Actions config file" do - bundle "gem #{gem_name} --ci=travis", :raise_on_error => false + bundle "gem #{gem_name} --ci=travis", raise_on_error: false expect(err).to include("Support for Travis CI was removed from gem skeleton generator.") expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist @@ -1007,7 +1007,7 @@ RSpec.describe "bundle gem" do context "gem.ci setting set to travis" do it "errors with friendly message" do bundle "config set gem.ci travis" - bundle "gem #{gem_name}", :raise_on_error => false + bundle "gem #{gem_name}", raise_on_error: false expect(err).to include("Support for Travis CI was removed from gem skeleton generator,") expect(err).to include("bundle config unset gem.ci") @@ -1143,7 +1143,7 @@ RSpec.describe "bundle gem" do end end - context "gem.rubocop setting set to true", :bundler => "< 3" do + context "gem.rubocop setting set to true", bundler: "< 3" do before do bundle "config set gem.rubocop true" bundle "gem #{gem_name}" @@ -1395,7 +1395,7 @@ RSpec.describe "bundle gem" do include_examples "generating a gem" context "--ext parameter with no value" do - context "is deprecated", :bundler => "< 3" do + context "is deprecated", bundler: "< 3" do it "prints deprecation when used after gem name" do bundle ["gem", "--ext", gem_name].compact.join(" ") expect(err).to include "[DEPRECATED]" @@ -1547,22 +1547,22 @@ RSpec.describe "bundle gem" do end it "fails gracefully with a ." do - bundle "gem foo.gemspec", :raise_on_error => false + bundle "gem foo.gemspec", raise_on_error: false expect(err).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name") end it "fails gracefully with a ^" do - bundle "gem ^", :raise_on_error => false + bundle "gem ^", raise_on_error: false expect(err).to end_with("Invalid gem name ^ -- `^` is an invalid constant name") end it "fails gracefully with a space" do - bundle "gem 'foo bar'", :raise_on_error => false + bundle "gem 'foo bar'", raise_on_error: false expect(err).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name") end it "fails gracefully when multiple names are passed" do - bundle "gem foo bar baz", :raise_on_error => false + bundle "gem foo bar baz", raise_on_error: false expect(err).to eq(<<-E.strip) ERROR: "bundle gem" was called with arguments ["foo", "bar", "baz"] Usage: "bundle gem NAME [OPTIONS]" @@ -1572,7 +1572,7 @@ Usage: "bundle gem NAME [OPTIONS]" describe "#ensure_safe_gem_name", :readline do before do - bundle "gem #{subject}", :raise_on_error => false + bundle "gem #{subject}", raise_on_error: false end context "with an existing const name" do @@ -1667,7 +1667,7 @@ Usage: "bundle gem NAME [OPTIONS]" context "on conflicts with a previously created file", :readline do it "should fail gracefully" do FileUtils.touch(bundled_app("conflict-foobar")) - bundle "gem conflict-foobar", :raise_on_error => false + bundle "gem conflict-foobar", raise_on_error: false expect(err).to eq("Couldn't create a new gem named `conflict-foobar` because there's an existing file named `conflict-foobar`.") expect(exitstatus).to eql(32) end diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb index 6ec64dd842..a51158b0dc 100644 --- a/spec/bundler/commands/open_spec.rb +++ b/spec/bundler/commands/open_spec.rb @@ -10,27 +10,27 @@ RSpec.describe "bundle open" do end it "opens the gem with BUNDLER_EDITOR as highest priority" do - bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } + bundle "open rails", env: { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } expect(out).to include("bundler_editor #{default_bundle_path("gems", "rails-2.3.2")}") end it "opens the gem with VISUAL as 2nd highest priority" do - bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "" } + bundle "open rails", env: { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "" } expect(out).to include("visual #{default_bundle_path("gems", "rails-2.3.2")}") end it "opens the gem with EDITOR as 3rd highest priority" do - bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open rails", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "rails-2.3.2")}") end it "complains if no EDITOR is set" do - bundle "open rails", :env => { "EDITOR" => "", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open rails", env: { "EDITOR" => "", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to eq("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") end it "complains if gem not in bundle" do - bundle "open missing", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open missing", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(err).to match(/could not find gem 'missing'/i) end @@ -43,64 +43,64 @@ RSpec.describe "bundle open" do gem 'foo', :git => "#{lib_path("foo-1.0")}" G - bundle "open foo", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open foo", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to match("editor #{default_bundle_path.join("bundler/gems/foo-1.0-#{ref}")}") end it "suggests alternatives for similar-sounding gems" do - bundle "open Rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open Rails", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(err).to match(/did you mean rails\?/i) end it "opens the gem with short words" do - bundle "open rec", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } + bundle "open rec", env: { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}") end it "opens subpath of the gem" do - bundle "open activerecord --path lib/activerecord", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open activerecord --path lib/activerecord", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "activerecord-2.3.2")}/lib/activerecord") end it "opens subpath file of the gem" do - bundle "open activerecord --path lib/version.rb", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open activerecord --path lib/version.rb", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "activerecord-2.3.2")}/lib/version.rb") end it "opens deep subpath of the gem" do - bundle "open activerecord --path lib/active_record", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open activerecord --path lib/active_record", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "activerecord-2.3.2")}/lib/active_record") end it "requires value for --path arg" do - bundle "open activerecord --path", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open activerecord --path", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(err).to eq "Cannot specify `--path` option without a value" end it "suggests alternatives for similar-sounding gems when using subpath" do - bundle "open Rails --path README.md", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open Rails --path README.md", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(err).to match(/did you mean rails\?/i) end it "suggests alternatives for similar-sounding gems when using deep subpath" do - bundle "open Rails --path some/path/here", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open Rails --path some/path/here", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(err).to match(/did you mean rails\?/i) end it "opens subpath of the short worded gem" do - bundle "open rec --path CHANGELOG.md", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open rec --path CHANGELOG.md", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "activerecord-2.3.2")}/CHANGELOG.md") end it "opens deep subpath of the short worded gem" do - bundle "open rec --path lib/activerecord", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open rec --path lib/activerecord", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("editor #{default_bundle_path("gems", "activerecord-2.3.2")}/lib/activerecord") end it "opens subpath of the selected matching gem", :readline do env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } - bundle "open active --path CHANGELOG.md", :env => env do |input, _, _| + bundle "open active --path CHANGELOG.md", env: env do |input, _, _| input.puts "2" end @@ -109,7 +109,7 @@ RSpec.describe "bundle open" do it "opens deep subpath of the selected matching gem", :readline do env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } - bundle "open active --path lib/activerecord/version.rb", :env => env do |input, _, _| + bundle "open active --path lib/activerecord/version.rb", env: env do |input, _, _| input.puts "2" end @@ -118,7 +118,7 @@ RSpec.describe "bundle open" do it "select the gem from many match gems", :readline do env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } - bundle "open active", :env => env do |input, _, _| + bundle "open active", env: env do |input, _, _| input.puts "2" end @@ -127,7 +127,7 @@ RSpec.describe "bundle open" do it "allows selecting exit from many match gems", :readline do env = { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } - bundle "open active", :env => env do |input, _, _| + bundle "open active", env: env do |input, _, _| input.puts "0" end end @@ -140,12 +140,12 @@ RSpec.describe "bundle open" do G bundle "config set auto_install 1" - bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open rails", env: { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } expect(out).to include("Installing foo 1.0") end it "opens the editor with a clean env" do - bundle "open", :env => { "EDITOR" => "sh -c 'env'", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false + bundle "open", env: { "EDITOR" => "sh -c 'env'", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, raise_on_error: false expect(out).not_to include("BUNDLE_GEMFILE=") end end @@ -169,7 +169,7 @@ RSpec.describe "bundle open" do end it "throws proper error when trying to open default gem" do - bundle "open json", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } + bundle "open json", env: { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" } expect(out).to include("Unable to open json because it's a default gem, so the directory it would normally be installed to does not exist.") end end diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index bbc3cb54ae..e7edc67e57 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -4,8 +4,8 @@ RSpec.describe "bundle outdated" do describe "with no arguments" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -23,11 +23,11 @@ RSpec.describe "bundle outdated" do update_repo2 do build_gem "activesupport", "3.0" build_gem "weakling", "0.2" - update_git "foo", :path => lib_path("foo") - update_git "zebra", :path => lib_path("zebra") + update_git "foo", path: lib_path("foo") + update_git "zebra", path: lib_path("zebra") end - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -50,7 +50,7 @@ RSpec.describe "bundle outdated" do gem "AAA", "1.0.0" G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE Gem Current Latest Requested Groups @@ -63,10 +63,10 @@ RSpec.describe "bundle outdated" do it "returns non zero exit status if outdated gems present" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expect(exitstatus).to_not be_zero end @@ -89,7 +89,7 @@ RSpec.describe "bundle outdated" do update_repo2 { build_gem "activesupport", "3.0" } update_repo2 { build_gem "terranova", "9" } - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -104,8 +104,8 @@ RSpec.describe "bundle outdated" do describe "with --verbose option" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -139,7 +139,7 @@ RSpec.describe "bundle outdated" do gem 'activesupport', '2.3.5' G - bundle "outdated --verbose", :raise_on_error => false + bundle "outdated --verbose", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups Path @@ -151,7 +151,7 @@ RSpec.describe "bundle outdated" do end end - describe "with multiple, duplicated sources, with lockfile in old format", :bundler => "< 3" do + describe "with multiple, duplicated sources, with lockfile in old format", bundler: "< 3" do before do build_repo2 do build_gem "dotenv", "2.7.6" @@ -205,8 +205,8 @@ RSpec.describe "bundle outdated" do end it "works" do - bundle :install, :artifice => "compact_index" - bundle :outdated, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index" + bundle :outdated, artifice: "compact_index", raise_on_error: false expected_output = <<~TABLE Gem Current Latest Requested Groups @@ -220,8 +220,8 @@ RSpec.describe "bundle outdated" do describe "with --group option" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -243,7 +243,7 @@ RSpec.describe "bundle outdated" do build_gem "duradura", "8.0" end - bundle "outdated --group #{group}", :raise_on_error => false + bundle "outdated --group #{group}", raise_on_error: false end it "works when the bundle is up to date" do @@ -290,8 +290,8 @@ RSpec.describe "bundle outdated" do describe "with --groups option and outdated transitive dependencies" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") build_gem "bar", %w[2.0.0] @@ -312,7 +312,7 @@ RSpec.describe "bundle outdated" do end it "returns a sorted list of outdated gems" do - bundle "outdated --groups", :raise_on_error => false + bundle "outdated --groups", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -326,8 +326,8 @@ RSpec.describe "bundle outdated" do describe "with --groups option" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -354,7 +354,7 @@ RSpec.describe "bundle outdated" do build_gem "duradura", "8.0" end - bundle "outdated --groups", :raise_on_error => false + bundle "outdated --groups", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -370,8 +370,8 @@ RSpec.describe "bundle outdated" do describe "with --local option" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -398,7 +398,7 @@ RSpec.describe "bundle outdated" do gem "activesupport", "2.3.4" G - bundle "outdated --local", :raise_on_error => false + bundle "outdated --local", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -420,8 +420,8 @@ RSpec.describe "bundle outdated" do context "and gems are outdated" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") build_gem "activesupport", "3.0" build_gem "weakling", "0.2" @@ -455,13 +455,13 @@ RSpec.describe "bundle outdated" do end describe "with --parseable option" do - subject { bundle "outdated --parseable", :raise_on_error => false } + subject { bundle "outdated --parseable", raise_on_error: false } it_behaves_like "a minimal output is desired" end describe "with aliased --porcelain option" do - subject { bundle "outdated --porcelain", :raise_on_error => false } + subject { bundle "outdated --porcelain", raise_on_error: false } it_behaves_like "a minimal output is desired" end @@ -469,8 +469,8 @@ RSpec.describe "bundle outdated" do describe "with specified gems" do it "returns list of outdated gems" do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -485,10 +485,10 @@ RSpec.describe "bundle outdated" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end - bundle "outdated foo", :raise_on_error => false + bundle "outdated foo", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -502,8 +502,8 @@ RSpec.describe "bundle outdated" do describe "pre-release gems" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -535,7 +535,7 @@ RSpec.describe "bundle outdated" do build_gem "activesupport", "3.0.0.beta" end - bundle "outdated --pre", :raise_on_error => false + bundle "outdated --pre", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -558,7 +558,7 @@ RSpec.describe "bundle outdated" do gem "activesupport", "3.0.0.beta.1" G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -573,8 +573,8 @@ RSpec.describe "bundle outdated" do describe "with --filter-strict option" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -594,7 +594,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "0.0.5" end - bundle :outdated, :"filter-strict" => true, :raise_on_error => false + bundle :outdated, "filter-strict": true, raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -610,7 +610,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "0.0.5" end - bundle :outdated, :strict => true, :raise_on_error => false + bundle :outdated, strict: true, raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -626,7 +626,7 @@ RSpec.describe "bundle outdated" do gem "activesupport", platforms: [:ruby_22] G - bundle :outdated, :"filter-strict" => true + bundle :outdated, "filter-strict": true expect(out).to end_with("Bundle up to date!") end @@ -637,7 +637,7 @@ RSpec.describe "bundle outdated" do gem "rack_middleware", "1.0" G - bundle :outdated, :"filter-strict" => true + bundle :outdated, "filter-strict": true expect(out).to end_with("Bundle up to date!") end @@ -714,8 +714,8 @@ RSpec.describe "bundle outdated" do describe "with invalid gem name" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -730,12 +730,12 @@ RSpec.describe "bundle outdated" do end it "returns could not find gem name" do - bundle "outdated invalid_gem_name", :raise_on_error => false + bundle "outdated invalid_gem_name", raise_on_error: false expect(err).to include("Could not find gem 'invalid_gem_name'.") end it "returns non-zero exit code" do - bundle "outdated invalid_gem_name", :raise_on_error => false + bundle "outdated invalid_gem_name", raise_on_error: false expect(exitstatus).to_not be_zero end end @@ -748,11 +748,11 @@ RSpec.describe "bundle outdated" do G bundle "config set auto_install 1" - bundle :outdated, :raise_on_error => false + bundle :outdated, raise_on_error: false expect(out).to include("Installing foo 1.0") end - context "after bundle install --deployment", :bundler => "< 3" do + context "after bundle install --deployment", bundler: "< 3" do before do build_repo2 @@ -763,13 +763,13 @@ RSpec.describe "bundle outdated" do gem "foo" G bundle :lock - bundle :install, :deployment => true + bundle :install, deployment: true end it "outputs a helpful message about being in deployment mode" do update_repo2 { build_gem "activesupport", "3.0" } - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expect(last_command).to be_failure expect(err).to include("You are trying to check outdated gems in deployment mode.") expect(err).to include("Run `bundle outdated` elsewhere.") @@ -781,8 +781,8 @@ RSpec.describe "bundle outdated" do context "after bundle config set --local deployment true" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -797,7 +797,7 @@ RSpec.describe "bundle outdated" do it "outputs a helpful message about being in deployment mode" do update_repo2 { build_gem "activesupport", "3.0" } - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expect(last_command).to be_failure expect(err).to include("You are trying to check outdated gems in deployment mode.") expect(err).to include("Run `bundle outdated` elsewhere.") @@ -843,7 +843,7 @@ RSpec.describe "bundle outdated" do gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby] G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -867,8 +867,8 @@ RSpec.describe "bundle outdated" do shared_examples_for "major version updates are detected" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -893,8 +893,8 @@ RSpec.describe "bundle outdated" do context "when on a new machine" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -909,22 +909,22 @@ RSpec.describe "bundle outdated" do simulate_new_machine - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") update_repo2 do build_gem "activesupport", "3.3.5" build_gem "weakling", "0.8.0" end end - subject { bundle "outdated", :raise_on_error => false } + subject { bundle "outdated", raise_on_error: false } it_behaves_like "version update is detected" end shared_examples_for "minor version updates are detected" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -949,8 +949,8 @@ RSpec.describe "bundle outdated" do shared_examples_for "patch version updates are detected" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -982,8 +982,8 @@ RSpec.describe "bundle outdated" do shared_examples_for "major version is ignored" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -1008,8 +1008,8 @@ RSpec.describe "bundle outdated" do shared_examples_for "minor version is ignored" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -1034,8 +1034,8 @@ RSpec.describe "bundle outdated" do shared_examples_for "patch version is ignored" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") - build_git "zebra", :path => lib_path("zebra") + build_git "foo", path: lib_path("foo") + build_git "zebra", path: lib_path("zebra") end install_gemfile <<-G @@ -1058,7 +1058,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major option" do - subject { bundle "outdated --filter-major", :raise_on_error => false } + subject { bundle "outdated --filter-major", raise_on_error: false } it_behaves_like "major version updates are detected" it_behaves_like "minor version is ignored" @@ -1066,7 +1066,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-minor option" do - subject { bundle "outdated --filter-minor", :raise_on_error => false } + subject { bundle "outdated --filter-minor", raise_on_error: false } it_behaves_like "minor version updates are detected" it_behaves_like "major version is ignored" @@ -1074,7 +1074,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-patch option" do - subject { bundle "outdated --filter-patch", :raise_on_error => false } + subject { bundle "outdated --filter-patch", raise_on_error: false } it_behaves_like "patch version updates are detected" it_behaves_like "major version is ignored" @@ -1082,7 +1082,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-minor --filter-patch options" do - subject { bundle "outdated --filter-minor --filter-patch", :raise_on_error => false } + subject { bundle "outdated --filter-minor --filter-patch", raise_on_error: false } it_behaves_like "minor version updates are detected" it_behaves_like "patch version updates are detected" @@ -1090,7 +1090,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-minor options" do - subject { bundle "outdated --filter-major --filter-minor", :raise_on_error => false } + subject { bundle "outdated --filter-major --filter-minor", raise_on_error: false } it_behaves_like "major version updates are detected" it_behaves_like "minor version updates are detected" @@ -1098,7 +1098,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-patch options" do - subject { bundle "outdated --filter-major --filter-patch", :raise_on_error => false } + subject { bundle "outdated --filter-major --filter-patch", raise_on_error: false } it_behaves_like "major version updates are detected" it_behaves_like "patch version updates are detected" @@ -1106,7 +1106,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-minor --filter-patch options" do - subject { bundle "outdated --filter-major --filter-minor --filter-patch", :raise_on_error => false } + subject { bundle "outdated --filter-major --filter-minor --filter-patch", raise_on_error: false } it_behaves_like "major version updates are detected" it_behaves_like "minor version updates are detected" @@ -1145,7 +1145,7 @@ RSpec.describe "bundle outdated" do end it "shows all gems when patching and filtering to patch" do - bundle "outdated --patch --filter-patch", :raise_on_error => false + bundle "outdated --patch --filter-patch", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -1158,7 +1158,7 @@ RSpec.describe "bundle outdated" do end it "shows minor and major when updating to minor and filtering to patch and minor" do - bundle "outdated --minor --filter-minor", :raise_on_error => false + bundle "outdated --minor --filter-minor", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -1170,7 +1170,7 @@ RSpec.describe "bundle outdated" do end it "shows minor when updating to major and filtering to minor with parseable" do - bundle "outdated --major --filter-minor --parseable", :raise_on_error => false + bundle "outdated --major --filter-minor --parseable", raise_on_error: false expect(out).not_to include("patch (newest") expect(out).to include("minor (newest") @@ -1212,7 +1212,7 @@ RSpec.describe "bundle outdated" do end it "shows gems updating to patch and filtering to patch" do - bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG_RESOLVER" => "1" } + bundle "outdated --patch --filter-patch", raise_on_error: false, env: { "DEBUG_RESOLVER" => "1" } expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -1224,7 +1224,7 @@ RSpec.describe "bundle outdated" do end it "shows gems updating to patch and filtering to patch, in debug mode" do - bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG" => "1" } + bundle "outdated --patch --filter-patch", raise_on_error: false, env: { "DEBUG" => "1" } expected_output = <<~TABLE.strip Gem Current Latest Requested Groups Path @@ -1256,7 +1256,7 @@ RSpec.describe "bundle outdated" do gem 'weakling' G - bundle "outdated --only-explicit", :raise_on_error => false + bundle "outdated --only-explicit", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -1306,7 +1306,7 @@ RSpec.describe "bundle outdated" do end it "reports a single entry per gem" do - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -1355,7 +1355,7 @@ RSpec.describe "bundle outdated" do end it "works" do - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups diff --git a/spec/bundler/commands/platform_spec.rb b/spec/bundler/commands/platform_spec.rb index 688bf7b6df..61e615acae 100644 --- a/spec/bundler/commands/platform_spec.rb +++ b/spec/bundler/commands/platform_spec.rb @@ -164,7 +164,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -177,7 +177,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -190,7 +190,7 @@ G gem "foo" G - bundle "platform", :raise_on_error => false + bundle "platform", raise_on_error: false expect(exitstatus).not_to eq(0) end @@ -347,7 +347,7 @@ G end it "doesn't install when the ruby version doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -359,7 +359,7 @@ G end it "doesn't install when engine doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -371,7 +371,7 @@ G end it "doesn't install when engine version doesn't match", :jruby_only do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -383,7 +383,7 @@ G end it "doesn't install when patchlevel doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -443,7 +443,7 @@ G #{ruby_version_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_ruby_version_incorrect end @@ -460,7 +460,7 @@ G #{engine_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_engine_incorrect end @@ -477,7 +477,7 @@ G #{engine_version_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_engine_version_incorrect end @@ -494,7 +494,7 @@ G #{patchlevel_incorrect} G - bundle :check, :raise_on_error => false + bundle :check, raise_on_error: false should_be_patchlevel_incorrect end end @@ -526,7 +526,7 @@ G build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end @@ -546,7 +546,7 @@ G build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end @@ -562,7 +562,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_ruby_version_incorrect end @@ -578,7 +578,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_engine_incorrect end @@ -594,7 +594,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_engine_version_incorrect end @@ -609,7 +609,7 @@ G build_gem "activesupport", "3.0" end - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false should_be_patchlevel_incorrect end end @@ -646,7 +646,7 @@ G expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "fails if ruby version doesn't match", :bundler => "< 3" do + it "fails if ruby version doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -654,11 +654,11 @@ G #{ruby_version_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_ruby_version_incorrect end - it "fails if engine doesn't match", :bundler => "< 3" do + it "fails if engine doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -666,11 +666,11 @@ G #{engine_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_engine_incorrect end - it "fails if engine version doesn't match", :bundler => "< 3", :jruby_only => true do + it "fails if engine version doesn't match", bundler: "< 3", jruby_only: true do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -678,11 +678,11 @@ G #{engine_version_incorrect} G - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_engine_version_incorrect end - it "fails when patchlevel doesn't match", :bundler => "< 3" do + it "fails when patchlevel doesn't match", bundler: "< 3" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -693,7 +693,7 @@ G build_gem "activesupport", "3.0" end - bundle "show rails", :raise_on_error => false + bundle "show rails", raise_on_error: false should_be_patchlevel_incorrect end end @@ -738,7 +738,7 @@ G #{ruby_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_ruby_version_incorrect end @@ -750,7 +750,7 @@ G #{engine_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_incorrect end @@ -762,7 +762,7 @@ G #{engine_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_version_incorrect end @@ -774,7 +774,7 @@ G #{patchlevel_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_patchlevel_incorrect end end @@ -819,7 +819,7 @@ G #{ruby_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_ruby_version_incorrect end @@ -831,7 +831,7 @@ G #{engine_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_incorrect end @@ -843,7 +843,7 @@ G #{engine_version_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_engine_version_incorrect end @@ -855,7 +855,7 @@ G #{patchlevel_incorrect} G - bundle :cache, :raise_on_error => false + bundle :cache, raise_on_error: false should_be_patchlevel_incorrect end end @@ -863,7 +863,7 @@ G context "bundle exec" do before do ENV["BUNDLER_FORCE_TTY"] = "true" - system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path + system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path end it "activates the correct gem when ruby version matches" do @@ -879,7 +879,7 @@ G end it "activates the correct gem when ruby version matches any engine", :jruby_only do - system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path + system_gems "rack-1.0.0", "rack-0.9.1", path: default_bundle_path gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack", "0.9.1" @@ -899,7 +899,7 @@ G #{ruby_version_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_ruby_version_incorrect end @@ -911,7 +911,7 @@ G #{engine_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_engine_incorrect end @@ -934,12 +934,12 @@ G #{patchlevel_incorrect} G - bundle "exec rackup", :raise_on_error => false + bundle "exec rackup", raise_on_error: false should_be_patchlevel_incorrect end end - context "bundle console", :bundler => "< 3" do + context "bundle console", bundler: "< 3" do before do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -993,7 +993,7 @@ G #{ruby_version_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_ruby_version_incorrect end @@ -1007,7 +1007,7 @@ G #{engine_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_engine_incorrect end @@ -1021,7 +1021,7 @@ G #{engine_version_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_engine_version_incorrect end @@ -1035,7 +1035,7 @@ G #{patchlevel_incorrect} G - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false should_be_patchlevel_incorrect end end @@ -1082,7 +1082,7 @@ G end it "fails when ruby version doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1092,14 +1092,14 @@ 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 }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_ruby_version_incorrect end it "fails when engine doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1109,14 +1109,14 @@ 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 }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_engine_incorrect end it "fails when engine version doesn't match", :jruby_only do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1126,14 +1126,14 @@ 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 }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "yard" gem "rack" @@ -1143,7 +1143,7 @@ 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 }, raise_on_error: false expect(bundled_app_lock).not_to exist should_be_patchlevel_incorrect @@ -1153,7 +1153,7 @@ G context "bundle outdated" do before do build_repo2 do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") end install_gemfile <<-G @@ -1166,7 +1166,7 @@ G it "returns list of outdated gems when the ruby version matches" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1177,7 +1177,7 @@ G #{ruby_version_correct} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -1192,7 +1192,7 @@ G bundle :install update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1203,7 +1203,7 @@ G #{ruby_version_correct_engineless} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -1217,7 +1217,7 @@ G it "fails when the ruby version doesn't match" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1228,14 +1228,14 @@ G #{ruby_version_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_ruby_version_incorrect end it "fails when the engine doesn't match" do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1246,14 +1246,14 @@ G #{engine_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_engine_incorrect end it "fails when the engine version doesn't match", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1264,14 +1264,14 @@ G #{engine_version_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_engine_version_incorrect end it "fails when the patchlevel doesn't match", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1282,14 +1282,14 @@ G #{patchlevel_incorrect} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_patchlevel_incorrect end it "fails when the patchlevel is a fixnum", :jruby_only do update_repo2 do build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") + update_git "foo", path: lib_path("foo") end gemfile <<-G @@ -1300,7 +1300,7 @@ G #{patchlevel_fixnum} G - bundle "outdated", :raise_on_error => false + bundle "outdated", raise_on_error: false should_be_patchlevel_fixnum end end diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 3050b87754..3c7fd3486d 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -114,7 +114,7 @@ RSpec.describe "post bundle message" do end it "should report a helpful error message" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" gem "not-a-gem", :group => :development @@ -131,7 +131,7 @@ Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)} G bundle :cache expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "rack" gem "not-a-gem", :group => :development @@ -142,7 +142,7 @@ Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)} end end - describe "for second bundle install run", :bundler => "< 3" do + describe "for second bundle install run", bundler: "< 3" do it "without any options" do 2.times { bundle :install } expect(out).to include(bundle_show_message) @@ -179,25 +179,25 @@ Could not find gem 'not-a-gem' in rubygems repository #{file_uri_for(gem_repo1)} describe "for bundle update" do it "shows proper messages according to the configured groups" do - bundle :update, :all => true + bundle :update, all: true expect(out).not_to include("Gems in the groups") expect(out).to include(bundle_updated_message) bundle "config set --local without emo" bundle :install - bundle :update, :all => true + bundle :update, all: true expect(out).to include("Gems in the group 'emo' were not updated") expect(out).to include(bundle_updated_message) bundle "config set --local without emo test" bundle :install - bundle :update, :all => true + bundle :update, all: true expect(out).to include("Gems in the groups 'emo' and 'test' were not updated") expect(out).to include(bundle_updated_message) bundle "config set --local without emo obama test" bundle :install - bundle :update, :all => true + bundle :update, all: true expect(out).to include("Gems in the groups 'emo', 'obama' and 'test' were not updated") expect(out).to include(bundle_updated_message) end diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb index 9e496dc91a..b9e58282bc 100644 --- a/spec/bundler/commands/pristine_spec.rb +++ b/spec/bundler/commands/pristine_spec.rb @@ -4,7 +4,7 @@ require "bundler/vendored_fileutils" RSpec.describe "bundle pristine" do before :each do - build_lib "baz", :path => bundled_app do |s| + build_lib "baz", path: bundled_app do |s| s.version = "1.0.0" s.add_development_dependency "baz-dev", "=1.0.0" end @@ -13,9 +13,9 @@ RSpec.describe "bundle pristine" do build_gem "weakling" build_gem "baz-dev", "1.0.0" build_gem "very_simple_binary", &:add_c_extension - build_git "foo", :path => lib_path("foo") - build_git "git_with_ext", :path => lib_path("git_with_ext"), &:add_c_extension - build_lib "bar", :path => lib_path("bar") + build_git "foo", path: lib_path("foo") + build_git "git_with_ext", path: lib_path("git_with_ext"), &:add_c_extension + build_lib "bar", path: lib_path("bar") end install_gemfile <<-G @@ -164,7 +164,7 @@ RSpec.describe "bundle pristine" do end it "raises when one of them is not in the lockfile" do - bundle "pristine abcabcabc", :raise_on_error => false + bundle "pristine abcabcabc", raise_on_error: false expect(err).to include("Could not find gem 'abcabcabc'.") end end @@ -205,7 +205,7 @@ RSpec.describe "bundle pristine" do context "when BUNDLE_GEMFILE doesn't exist" do before do - bundle "pristine", :env => { "BUNDLE_GEMFILE" => "does/not/exist" }, :raise_on_error => false + bundle "pristine", env: { "BUNDLE_GEMFILE" => "does/not/exist" }, raise_on_error: false end it "shows a meaningful error" do diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index d757e0be4b..197fcde091 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "bundle remove" do source "#{file_uri_for(gem_repo1)}" G - bundle "remove", :raise_on_error => false + bundle "remove", raise_on_error: false expect(err).to include("Please specify gems to remove.") end @@ -43,7 +43,7 @@ RSpec.describe "bundle remove" do end end - context "when --install flag is specified", :bundler => "< 3" do + context "when --install flag is specified", bundler: "< 3" do it "removes gems from .bundle" do gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -109,7 +109,7 @@ RSpec.describe "bundle remove" do source "#{file_uri_for(gem_repo1)}" G - bundle "remove rack", :raise_on_error => false + bundle "remove rack", raise_on_error: false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end @@ -146,7 +146,7 @@ RSpec.describe "bundle remove" do gem "rspec" G - bundle "remove rails rack minitest", :raise_on_error => false + bundle "remove rails rack minitest", raise_on_error: false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") expect(gemfile).to eq <<~G @@ -373,7 +373,7 @@ RSpec.describe "bundle remove" do gem "rack"; gem "rails" G - bundle "remove rails", :raise_on_error => false + bundle "remove rails", raise_on_error: false expect(err).to include("Gems could not be removed. rack (>= 0) would also have been removed.") expect(gemfile).to eq <<~G @@ -385,7 +385,7 @@ RSpec.describe "bundle remove" do context "when some gems could not be removed" do it "shows warning for gems not removed and success for those removed" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem"rack" gem"rspec" @@ -491,7 +491,7 @@ RSpec.describe "bundle remove" do eval_gemfile "Gemfile-other" G - bundle "remove rack", :raise_on_error => false + bundle "remove rack", raise_on_error: false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end @@ -510,7 +510,7 @@ RSpec.describe "bundle remove" do gem "rack" G - bundle "remove rack", :raise_on_error => false + bundle "remove rack", raise_on_error: false expect(out).to include("rack was removed.") expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.") @@ -535,7 +535,7 @@ RSpec.describe "bundle remove" do gem "rack" G - bundle "remove rack", :raise_on_error => false + bundle "remove rack", raise_on_error: false expect(out).to include("rack was removed.") expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") @@ -560,7 +560,7 @@ RSpec.describe "bundle remove" do gem "rails"; gem "rack" G - bundle "remove rack", :raise_on_error => false + bundle "remove rack", raise_on_error: false expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") expect(bundled_app("Gemfile-other").read).to include("gem \"rack\"") @@ -634,7 +634,7 @@ RSpec.describe "bundle remove" do context "with gemspec" do it "should not remove the gem" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("foo.gemspec", "") s.add_dependency "rack" end diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index 1c6244be41..207ba488bd 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle show", :bundler => "< 3" do +RSpec.describe "bundle show", bundler: "< 3" do context "with a standard Gemfile" do before :each do install_gemfile <<-G @@ -50,7 +50,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "complains if gem not in bundle" do - bundle "show missing", :raise_on_error => false + bundle "show missing", raise_on_error: false expect(err).to match(/could not find gem 'missing'/i) end @@ -104,7 +104,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "prints out branch names other than main" do - update_git "foo", :branch => "omg" do |s| + update_git "foo", branch: "omg" do |s| s.write "lib/foo.rb", "FOO = '1.0.omg'" end @revision = revision_for(lib_path("foo-1.0"))[0...6] @@ -129,7 +129,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "handles when a version is a '-' prerelease" do - @git = build_git("foo", "1.0.0-beta.1", :path => lib_path("foo")) + @git = build_git("foo", "1.0.0-beta.1", path: lib_path("foo")) install_gemfile <<-G gem "foo", "1.0.0-beta.1", :git => "#{lib_path("foo")}" G @@ -142,13 +142,13 @@ RSpec.describe "bundle show", :bundler => "< 3" do context "in a fresh gem in a blank git repo" do before :each do - build_git "foo", :path => lib_path("foo") + build_git "foo", path: lib_path("foo") File.open(lib_path("foo/Gemfile"), "w") {|f| f.puts "gemspec" } - sys_exec "rm -rf .git && git init", :dir => lib_path("foo") + sys_exec "rm -rf .git && git init", dir: lib_path("foo") end it "does not output git errors" do - bundle :show, :dir => lib_path("foo") + bundle :show, dir: lib_path("foo") expect(err_without_deprecations).to be_empty end end @@ -186,7 +186,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do invalid_regexp = "[]" - bundle "show #{invalid_regexp}", :raise_on_error => false + bundle "show #{invalid_regexp}", raise_on_error: false expect(err).to include("Could not find gem '#{invalid_regexp}'.") end end @@ -219,6 +219,6 @@ RSpec.describe "bundle show", :bundler => "< 3" do end end -RSpec.describe "bundle show", :bundler => "3" do +RSpec.describe "bundle show", bundler: "3" do pending "shows a friendly error about the command removal" end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index c7b6934526..013cadd541 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "bundle update" do gem "rack-obama" exit! G - bundle "update", :raise_on_error => false + bundle "update", raise_on_error: false expect(bundled_app_lock).to exist end end @@ -60,7 +60,7 @@ RSpec.describe "bundle update" do build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(out).to include("Bundle updated!") expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end @@ -74,7 +74,7 @@ RSpec.describe "bundle update" do gem "rack-obama" exit! G - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false expect(bundled_app_lock).to exist end end @@ -86,7 +86,7 @@ RSpec.describe "bundle update" do gem "rack", "1.0" G - bundle "update --gemfile OmgFile", :all => true + bundle "update --gemfile OmgFile", all: true expect(bundled_app("OmgFile.lock")).to exist end @@ -97,13 +97,13 @@ RSpec.describe "bundle update" do it "errors when passed nothing" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - bundle :update, :raise_on_error => false + bundle :update, raise_on_error: false expect(err).to eq("To update everything, pass the `--all` flag.") end it "errors when passed --all and another option" do install_gemfile "source \"#{file_uri_for(gem_repo1)}\"" - bundle "update --all foo", :raise_on_error => false + bundle "update --all foo", raise_on_error: false expect(err).to eq("Cannot specify --all along with specific options.") end @@ -171,11 +171,11 @@ RSpec.describe "bundle update" do end it "should inform the user" do - bundle "update halting-problem-solver", :raise_on_error => false + bundle "update halting-problem-solver", raise_on_error: false expect(err).to include "Could not find gem 'halting-problem-solver'" end it "should suggest alternatives" do - bundle "update platformspecific", :raise_on_error => false + bundle "update platformspecific", raise_on_error: false expect(err).to include "Did you mean platform_specific?" end end @@ -236,7 +236,7 @@ RSpec.describe "bundle update" do end end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems("slim 3.0.9", "slim-rails 3.1.3", "slim_lint 0.16.1") end @@ -301,7 +301,7 @@ RSpec.describe "bundle update" do previous_lockfile = lockfile - bundle "lock --update", :env => { "DEBUG" => "1" }, :verbose => true + bundle "lock --update", env: { "DEBUG" => "1" }, verbose: true expect(lockfile).to eq(previous_lockfile) end @@ -439,7 +439,7 @@ RSpec.describe "bundle update" do build_gem "c", "2.0" end - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo4)}" gem "a" G @@ -452,7 +452,7 @@ RSpec.describe "bundle update" do end end - bundle "update", :all => true, :verbose => true + bundle "update", all: true, verbose: true expect(the_bundle).to include_gems("a 1.0", "b 1.0", "c 2.0") end @@ -639,7 +639,7 @@ RSpec.describe "bundle update" do context "when there is a source with the same name as a gem in a group" do before do - build_git "foo", :path => lib_path("activesupport") + build_git "foo", path: lib_path("activesupport") install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem "activesupport", :group => :development @@ -649,7 +649,7 @@ RSpec.describe "bundle update" do it "should not update the gems from that source" do update_repo2 { build_gem "activesupport", "3.0" } - update_git "foo", "2.0", :path => lib_path("activesupport") + update_git "foo", "2.0", path: lib_path("activesupport") bundle "update --group development" expect(the_bundle).to include_gems "activesupport 3.0" @@ -691,9 +691,9 @@ RSpec.describe "bundle update" do G end - it "should fail loudly", :bundler => "< 3" do + it "should fail loudly", bundler: "< 3" do bundle "install --deployment" - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false expect(last_command).to be_failure expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/) @@ -702,20 +702,20 @@ RSpec.describe "bundle update" do it "should fail loudly when frozen is set globally" do bundle "config set --global frozen 1" - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/). and match(/freeze by running `bundle config set frozen false`./) end it "should fail loudly when deployment is set globally" do bundle "config set --global deployment true" - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/). and match(/freeze by running `bundle config set frozen false`./) end it "should not suggest any command to unfreeze bundler if frozen is set through ENV" do - bundle "update", :all => true, :raise_on_error => false, :env => { "BUNDLE_FROZEN" => "true" } + bundle "update", all: true, raise_on_error: false, env: { "BUNDLE_FROZEN" => "true" } expect(err).to match(/Bundler is unlocking, but the lockfile can't be updated because frozen mode is set/) expect(err).not_to match(/by running/) end @@ -818,14 +818,14 @@ RSpec.describe "bundle update" do gem "activesupport" G - bundle "update", :all => true, :verbose => true + bundle "update", all: true, verbose: true expect(out).to include("Using activesupport 2.3.5") update_repo2 do build_gem "activesupport", "3.0" end - bundle "update", :all => true + bundle "update", all: true expect(out).to include("Installing activesupport 3.0 (was 2.3.5)") end @@ -841,14 +841,14 @@ RSpec.describe "bundle update" do gem "foo" G - bundle "update", :all => true + bundle "update", all: true expect(out).to match(/Resolving dependencies\.\.\.\.*\nBundle updated!/) update_repo4 do build_gem "foo", "2.0" end - bundle "update", :all => true + bundle "update", all: true out.sub!("Removing foo (1.0)\n", "") expect(out).to match(/Resolving dependencies\.\.\.\.*\nFetching foo 2\.0 \(was 1\.0\)\nInstalling foo 2\.0 \(was 1\.0\)\nBundle updated/) end @@ -859,12 +859,12 @@ RSpec.describe "bundle update" do gem "activesupport" G - bundle "update nonexisting", :raise_on_error => false + bundle "update nonexisting", raise_on_error: false expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.") expect(exitstatus).to eq(22) end - context "with multiple, duplicated sources, with lockfile in old format", :bundler => "< 3" do + context "with multiple, duplicated sources, with lockfile in old format", bundler: "< 3" do before do build_repo2 do build_gem "dotenv", "2.7.6" @@ -918,8 +918,8 @@ RSpec.describe "bundle update" do end it "works" do - bundle :install, :artifice => "compact_index" - bundle "update oj", :artifice => "compact_index" + bundle :install, artifice: "compact_index" + bundle "update oj", artifice: "compact_index" expect(out).to include("Bundle updated!") expect(the_bundle).to include_gems "oj 3.11.5" @@ -1055,7 +1055,7 @@ RSpec.describe "bundle update in more complicated situations" do end it "allows updating" do - bundle :update, :all => true + bundle :update, all: true expect(the_bundle).to include_gem "a 1.1" end @@ -1111,7 +1111,7 @@ RSpec.describe "bundle update without a Gemfile.lock" do gem "rack", "1.0" G - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "rack 1.0.0" end @@ -1134,7 +1134,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end it "should explain that bundler conflicted and how to resolve the conflict" do - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false expect(last_command.stdboth).not_to match(/in snapshot/i) expect(err).to match(/current Bundler version/i). and match(/Install the necessary version with `gem install bundler:#{Bundler::VERSION.succ}`/i) @@ -1221,7 +1221,7 @@ RSpec.describe "bundle update --ruby" do G end it "shows a helpful error message" do - bundle "update --ruby", :raise_on_error => false + bundle "update --ruby", raise_on_error: false expect(err).to include("Your Ruby version is #{Bundler::RubyVersion.system.gem_version}, but your Gemfile specified ~> 2.1.0") end @@ -1310,7 +1310,7 @@ RSpec.describe "bundle update --bundler" do L lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2') - bundle :update, :bundler => true, :artifice => "compact_index", :verbose => true + bundle :update, bundler: true, artifice: "compact_index", verbose: true expect(out).to include("Using bundler #{Bundler::VERSION}") expect(lockfile).to eq <<~L @@ -1349,7 +1349,7 @@ RSpec.describe "bundle update --bundler" do c.checksum(gem_repo4, "rack", "1.0") end - bundle :update, :bundler => true, :artifice => "compact_index", :verbose => true + bundle :update, bundler: true, artifice: "compact_index", verbose: true expect(out).to include("Using bundler #{Bundler::VERSION}") expect(lockfile).to eq <<~L @@ -1378,13 +1378,13 @@ RSpec.describe "bundle update --bundler" do build_gem "rack", "1.0" end - install_gemfile <<-G, :env => { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } + install_gemfile <<-G, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } source "#{file_uri_for(gem_repo4)}" gem "rack" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") - bundle :update, :bundler => true, :artifice => "vcr", :verbose => true, :env => { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } + bundle :update, bundler: true, artifice: "vcr", verbose: true, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } # Only updates properly on modern RubyGems. @@ -1422,13 +1422,13 @@ RSpec.describe "bundle update --bundler" do build_gem "rack", "1.0" end - install_gemfile <<-G, :env => { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } + install_gemfile <<-G, env: { "BUNDLER_IGNORE_DEFAULT_GEM" => "true" } source "#{file_uri_for(gem_repo4)}" gem "rack" G lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.3.9") - bundle :update, :bundler => "999.999.999", :artifice => "vcr", :raise_on_error => false + bundle :update, bundler: "999.999.999", artifice: "vcr", raise_on_error: false # Only gives a meaningful error message on modern RubyGems. @@ -1450,7 +1450,7 @@ RSpec.describe "bundle update --bundler" do gem "rack" G - bundle :update, :bundler => "2.3.0.dev", :verbose => "true" + bundle :update, bundler: "2.3.0.dev", verbose: "true" # Only updates properly on modern RubyGems. if Gem.rubygems_version >= Gem::Version.new("3.3.0.dev") @@ -1490,7 +1490,7 @@ RSpec.describe "bundle update --bundler" do gem "rack" G - bundle :update, :bundler => "2.3.9", :verbose => true + bundle :update, bundler: "2.3.9", verbose: true expect(out).not_to include("Fetching gem metadata from https://rubygems.org/") @@ -1541,7 +1541,7 @@ RSpec.describe "bundle update --bundler" do 2.1.4 L - bundle "update --bundler=2.3.9", :env => { "BUNDLE_FROZEN" => "true" }, :raise_on_error => false + bundle "update --bundler=2.3.9", env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false expect(err).to include("An update to the version of bundler itself was requested, but the lockfile can't be updated because frozen mode is set") end end @@ -1601,7 +1601,7 @@ RSpec.describe "bundle update conservative" do end it "update all" do - bundle "update --patch", :all => true + bundle "update --patch", all: true expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.1" end @@ -1623,7 +1623,7 @@ RSpec.describe "bundle update conservative" do end it "minor preferred" do - bundle "update --minor --strict", :all => true + bundle "update --minor --strict", all: true expect(the_bundle).to include_gems "foo 1.5.0", "bar 2.1.1", "qux 1.1.0" end @@ -1790,7 +1790,7 @@ RSpec.describe "bundle update conservative" do end it "raises if too many flags are provided" do - bundle "update --patch --minor", :all => true, :raise_on_error => false + bundle "update --patch --minor", all: true, raise_on_error: false expect(err).to eq "Provide only one of the following options: minor, patch" end diff --git a/spec/bundler/commands/version_spec.rb b/spec/bundler/commands/version_spec.rb index 6521f10e50..307058a5dd 100644 --- a/spec/bundler/commands/version_spec.rb +++ b/spec/bundler/commands/version_spec.rb @@ -10,36 +10,36 @@ RSpec.describe "bundle version" do end context "with -v" do - it "outputs the version", :bundler => "< 3" do + it "outputs the version", bundler: "< 3" do bundle "-v" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "3" do + it "outputs the version", bundler: "3" do bundle "-v" expect(out).to eq(Bundler::VERSION) end end context "with --version" do - it "outputs the version", :bundler => "< 3" do + it "outputs the version", bundler: "< 3" do bundle "--version" expect(out).to eq("Bundler version #{Bundler::VERSION}") end - it "outputs the version", :bundler => "3" do + it "outputs the version", bundler: "3" do bundle "--version" expect(out).to eq(Bundler::VERSION) end end context "with version" do - it "outputs the version with build metadata", :bundler => "< 3" do + it "outputs the version with build metadata", bundler: "< 3" do bundle "version" expect(out).to match(/\ABundler version #{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end - it "outputs the version with build metadata", :bundler => "3" do + it "outputs the version with build metadata", bundler: "3" do bundle "version" expect(out).to match(/\A#{Regexp.escape(Bundler::VERSION)} \(\d{4}-\d{2}-\d{2} commit #{COMMIT_HASH}\)\z/) end diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb index b25683bfb3..f8b5f7836e 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"), :realworld => true 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 @@ -15,7 +15,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re bundle "viz" expect(out).to include("gem_graph.png") - bundle "viz", :format => "debug" + bundle "viz", format: "debug" expect(out).to eq(<<~DOT.strip) digraph Gemfile { concentrate = "true"; @@ -49,7 +49,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re bundle "viz" expect(out).to include("gem_graph.png") - bundle "viz", :format => :debug, :version => true + bundle "viz", format: :debug, version: true expect(out).to eq(<<~EOS.strip) digraph Gemfile { concentrate = "true"; @@ -77,7 +77,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re end end - system_gems "graphviz-999", :gem_repo => gem_repo4 + system_gems "graphviz-999", gem_repo: gem_repo4 end it "loads the correct ruby-graphviz gem" do @@ -87,7 +87,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re gem "rack-obama" G - bundle "viz", :format => "debug" + bundle "viz", format: "debug" expect(out).to eq(<<~DOT.strip) digraph Gemfile { concentrate = "true"; diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb index 75c7aa9085..8da94718e0 100644 --- a/spec/bundler/install/allow_offline_install_spec.rb +++ b/spec/bundler/install/allow_offline_install_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "bundle install with :allow_offline_install" do context "with no cached data locally" do it "still installs" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "http://testgemserver.local" gem "rack-obama" G @@ -15,7 +15,7 @@ RSpec.describe "bundle install with :allow_offline_install" do end it "still fails when the network is down" do - install_gemfile <<-G, :artifice => "fail", :raise_on_error => false + install_gemfile <<-G, artifice: "fail", raise_on_error: false source "http://testgemserver.local" gem "rack-obama" G @@ -26,10 +26,10 @@ RSpec.describe "bundle install with :allow_offline_install" do context "with cached data locally" do it "will install from the compact index" do - system_gems ["rack-1.0.0"], :path => default_bundle_path + system_gems ["rack-1.0.0"], path: default_bundle_path bundle "config set clean false" - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "http://testgemserver.local" gem "rack-obama" gem "rack", "< 1.0" @@ -42,7 +42,7 @@ RSpec.describe "bundle install with :allow_offline_install" do gem "rack-obama" G - bundle :update, :artifice => "fail", :all => true + bundle :update, artifice: "fail", all: true expect(last_command.stdboth).to include "Using the cached data for the new index because of a network error" expect(the_bundle).to include_gems("rack-obama 1.0", "rack 1.0.0") @@ -75,14 +75,14 @@ RSpec.describe "bundle install with :allow_offline_install" do it "will install from a cached git repo" do skip "doesn't print errors" if Gem.win_platform? - git = build_git "a", "1.0.0", :path => lib_path("a") - update_git("a", :path => git.path, :branch => "new_branch") + git = build_git "a", "1.0.0", path: lib_path("a") + update_git("a", path: git.path, branch: "new_branch") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "a", :git => #{git.path.to_s.dump} G - break_git_remote_ops! { bundle :update, :all => true } + break_git_remote_ops! { bundle :update, all: true } expect(err).to include("Using cached git data because of network errors") expect(the_bundle).to be_locked diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb index a0d5332e96..19911f1154 100644 --- a/spec/bundler/install/bundler_spec.rb +++ b/spec/bundler/install/bundler_spec.rb @@ -30,7 +30,7 @@ RSpec.describe "bundle install" do end it "causes a conflict if explicitly requesting a different version of bundler" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rails", "3.0" gem "bundler", "0.9.1" @@ -50,7 +50,7 @@ RSpec.describe "bundle install" do end it "causes a conflict if explicitly requesting a non matching requirement on bundler" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rails", "3.0" gem "bundler", "~> 0.8" @@ -73,7 +73,7 @@ RSpec.describe "bundle install" do end it "causes a conflict if explicitly requesting a version of bundler that doesn't exist" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rails", "3.0" gem "bundler", "0.9.2" @@ -143,7 +143,7 @@ RSpec.describe "bundle install" do end end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "activemerchant" gem "rails_pinned_to_old_activesupport" @@ -171,7 +171,7 @@ RSpec.describe "bundle install" do end end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rails_pinned_to_old_activesupport" gem "activesupport", "2.3.5" diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index f7b41595be..0ddee39ce3 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -8,26 +8,26 @@ RSpec.describe "install in deployment or frozen mode" do G end - context "with CLI flags", :bundler => "< 3" do + context "with CLI flags", bundler: "< 3" do it "fails without a lockfile and says that --deployment requires a lock" do - bundle "install --deployment", :raise_on_error => false + bundle "install --deployment", raise_on_error: false expect(err).to include("The --deployment flag requires a lockfile") end it "fails without a lockfile and says that --frozen requires a lock" do - bundle "install --frozen", :raise_on_error => false + bundle "install --frozen", raise_on_error: false expect(err).to include("The --frozen flag requires a lockfile") end it "disallows --deployment --system" do - bundle "install --deployment --system", :raise_on_error => false + bundle "install --deployment --system", raise_on_error: false expect(err).to include("You have specified both --deployment") expect(err).to include("Please choose only one option") expect(exitstatus).to eq(15) end it "disallows --deployment --path --system" do - bundle "install --deployment --path . --system", :raise_on_error => false + bundle "install --deployment --path . --system", raise_on_error: false expect(err).to include("You have specified both --path") expect(err).to include("as well as --system") expect(err).to include("Please choose only one option") @@ -35,7 +35,7 @@ RSpec.describe "install in deployment or frozen mode" do end it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do - bundle "install --deployment", :raise_on_error => false + bundle "install --deployment", raise_on_error: false bundle :install expect(the_bundle).to include_gems "rack 1.0" end @@ -65,7 +65,7 @@ RSpec.describe "install in deployment or frozen mode" do gem "rack-obama" G - bundle "install --deployment", :raise_on_error => false + bundle "install --deployment", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") expect(err).to include("* rack-obama") @@ -79,7 +79,7 @@ RSpec.describe "install in deployment or frozen mode" do simulate_new_machine bundle "config set --local deployment true" bundle "config set --local path vendor/bundle" - bundle "install --gemfile #{tmp}/bundled_app/Gemfile", :dir => tmp + bundle "install --gemfile #{tmp}/bundled_app/Gemfile", dir: tmp expect(the_bundle).to include_gems "rack 1.0" end @@ -103,12 +103,12 @@ RSpec.describe "install in deployment or frozen mode" do bundle :install bundle "config set --local deployment true" bundle :install - bundle "exec bundle check", :env => { "PATH" => path } + bundle "exec bundle check", env: { "PATH" => path } end it "works when using path gems from the same path and the version is specified" do - build_lib "foo", :path => lib_path("nested/foo") - build_lib "bar", :path => lib_path("nested/bar") + build_lib "foo", path: lib_path("nested/foo") + build_lib "bar", path: lib_path("nested/bar") gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "foo", "1.0", :path => "#{lib_path("nested")}" @@ -121,7 +121,7 @@ RSpec.describe "install in deployment or frozen mode" do end it "works when path gems are specified twice" do - build_lib "foo", :path => lib_path("nested/foo") + build_lib "foo", path: lib_path("nested/foo") gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "foo", :path => "#{lib_path("nested/foo")}" @@ -134,14 +134,14 @@ RSpec.describe "install in deployment or frozen mode" do end it "works when there are credentials in the source URL" do - install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true) + install_gemfile(<<-G, artifice: "endpoint_strict_basic_authentication", quiet: true) source "http://user:[email protected]/" gem "rack-obama", ">= 1.0" G bundle "config set --local deployment true" - bundle :install, :artifice => "endpoint_strict_basic_authentication" + bundle :install, artifice: "endpoint_strict_basic_authentication" end it "works with sources given by a block" do @@ -184,7 +184,7 @@ RSpec.describe "install in deployment or frozen mode" do end it "prevents the replace by default" do - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/The list of sources changed/) end @@ -203,7 +203,7 @@ RSpec.describe "install in deployment or frozen mode" do before { bundle "config set allow_deployment_source_credential_changes false" } it "prevents the replace" do - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/The list of sources changed/) end @@ -223,7 +223,7 @@ RSpec.describe "install in deployment or frozen mode" do before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" } it "prevents the replace" do - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/The list of sources changed/) end @@ -250,7 +250,7 @@ RSpec.describe "install in deployment or frozen mode" do it "installs gems to custom path if specified, even when configured through ENV" do bundle "config set deployment true" - bundle "install", :env => { "BUNDLE_PATH" => "vendor/bundle2" } + bundle "install", env: { "BUNDLE_PATH" => "vendor/bundle2" } expect(out).to include("vendor/bundle2") end @@ -260,7 +260,7 @@ RSpec.describe "install in deployment or frozen mode" do end it "works with BUNDLE_FROZEN if you didn't change anything" do - bundle :install, :env => { "BUNDLE_FROZEN" => "true" } + bundle :install, env: { "BUNDLE_FROZEN" => "true" } end it "explodes with the `deployment` setting if you make a change and don't check in the lockfile" do @@ -271,7 +271,7 @@ RSpec.describe "install in deployment or frozen mode" do G bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") expect(err).to include("* rack-obama") @@ -292,7 +292,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config set --local path .bundle" bundle "config set --local without development" bundle "config set --local deployment true" - bundle :install, :env => { "DEBUG" => "1" } + bundle :install, env: { "DEBUG" => "1" } run "puts :WIN" expect(out).to eq("WIN") end @@ -308,7 +308,7 @@ RSpec.describe "install in deployment or frozen mode" do end G - bundle :install, :env => { "BUNDLE_FROZEN" => "true" } + bundle :install, env: { "BUNDLE_FROZEN" => "true" } expect(last_command).to be_success end @@ -342,7 +342,7 @@ RSpec.describe "install in deployment or frozen mode" do #{Bundler::VERSION} L - bundle :install, :env => { "BUNDLE_FROZEN" => "true" }, :raise_on_error => false, :artifice => "compact_index" + bundle :install, env: { "BUNDLE_FROZEN" => "true" }, raise_on_error: false, artifice: "compact_index" expect(err).to include("Your lock file is missing \"bar\", but the lockfile can't be updated because frozen mode is set") end @@ -358,7 +358,7 @@ RSpec.describe "install in deployment or frozen mode" do bundle "config set --local path .bundle" bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.") end @@ -370,7 +370,7 @@ RSpec.describe "install in deployment or frozen mode" do G ENV["BUNDLE_FROZEN"] = "1" - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") expect(err).to include("* rack-obama") @@ -386,7 +386,7 @@ RSpec.describe "install in deployment or frozen mode" do G ENV["BUNDLE_DEPLOYMENT"] = "true" - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile") expect(err).to include("* rack-obama") @@ -429,7 +429,7 @@ RSpec.describe "install in deployment or frozen mode" do G bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n") expect(err).to include("You have deleted from the Gemfile:\n* rack") @@ -443,7 +443,7 @@ RSpec.describe "install in deployment or frozen mode" do G bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).not_to include("You have added to the Gemfile") expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `git://hubz.com`") @@ -463,7 +463,7 @@ RSpec.describe "install in deployment or frozen mode" do G bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).not_to include("You have deleted from the Gemfile") expect(err).not_to include("You have added to the Gemfile") @@ -471,8 +471,8 @@ RSpec.describe "install in deployment or frozen mode" do end it "explodes if you change a source" do - build_lib "foo", :path => lib_path("rack/foo") - build_git "rack", :path => lib_path("rack") + build_lib "foo", path: lib_path("rack/foo") + build_git "rack", path: lib_path("rack") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -487,7 +487,7 @@ RSpec.describe "install in deployment or frozen mode" do G bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("frozen mode") expect(err).to include("You have changed in the Gemfile:\n* rack from `#{lib_path("rack")}` to `no specified source`") expect(err).not_to include("You have added to the Gemfile") @@ -505,7 +505,7 @@ RSpec.describe "install in deployment or frozen mode" do gem "rack-obama" G - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(err).to include <<~E.strip The dependencies in your gemfile changed, but the lockfile can't be updated because frozen mode is set (Bundler::ProductionError) @@ -521,7 +521,7 @@ RSpec.describe "install in deployment or frozen mode" do context "with path in Gemfile and packed" do it "works fine after bundle package and bundle install --local" do - build_lib "foo", :path => lib_path("foo") + build_lib "foo", path: lib_path("foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "foo", :path => "#{lib_path("foo")}" diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb index 4a9c33754f..f972a37bf6 100644 --- a/spec/bundler/install/failure_spec.rb +++ b/spec/bundler/install/failure_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "bundle install" do end end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rails" G @@ -39,7 +39,7 @@ In Gemfile: end it "removes the downloaded .gem" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo4)}" gem "a" G diff --git a/spec/bundler/install/gemfile/eval_gemfile_spec.rb b/spec/bundler/install/gemfile/eval_gemfile_spec.rb index 02283291b4..cfa66e5986 100644 --- a/spec/bundler/install/gemfile/eval_gemfile_spec.rb +++ b/spec/bundler/install/gemfile/eval_gemfile_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do before do - build_lib("gunks", :path => bundled_app.join("gems/gunks")) do |s| + build_lib("gunks", path: bundled_app.join("gems/gunks")) do |s| s.name = "gunks" s.version = "0.0.1" end @@ -24,7 +24,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do expect(out).to include("Resolving dependencies") expect(out).to include("Bundle complete") - expect(the_bundle).to include_gem "gunks 0.0.1", :source => "path@#{bundled_app("gems", "gunks")}" + expect(the_bundle).to include_gem "gunks 0.0.1", source: "path@#{bundled_app("gems", "gunks")}" end end @@ -64,7 +64,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do context "eval-ed Gemfile has relative-path gems" do before do - build_lib("a", :path => bundled_app("gems/a")) + build_lib("a", path: bundled_app("gems/a")) create_file bundled_app("nested/Gemfile-nested"), <<-G source "#{file_uri_for(gem_repo1)}" gem "a", :path => "../gems/a" @@ -102,7 +102,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do expect(out).to include("Resolving dependencies") expect(out).to include("Bundle complete") - expect(the_bundle).to include_gem "gunks 0.0.1", :source => "path@#{bundled_app("gems", "gunks")}" + expect(the_bundle).to include_gem "gunks 0.0.1", source: "path@#{bundled_app("gems", "gunks")}" end end diff --git a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb index dbdadb7faa..a29b79ad62 100644 --- a/spec/bundler/install/gemfile/force_ruby_platform_spec.rb +++ b/spec/bundler/install/gemfile/force_ruby_platform_spec.rb @@ -39,7 +39,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do end it "still respects a global `force_ruby_platform` config" do - install_gemfile <<-G, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } + install_gemfile <<-G, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } source "#{file_uri_for(gem_repo4)}" gem "platform_specific_forced", :force_ruby_platform => true @@ -105,7 +105,7 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do end it "ignores ruby variants for the transitive dependencies" do - install_gemfile <<-G, :env => { "DEBUG_RESOLVER" => "true" } + install_gemfile <<-G, env: { "DEBUG_RESOLVER" => "true" } source "#{file_uri_for(gem_repo4)}" gem "depends_on_platform_specific", :force_ruby_platform => true @@ -132,9 +132,9 @@ RSpec.describe "bundle install with force_ruby_platform DSL option", :jruby do #{Bundler::VERSION} L - system_gems "platform_specific-1.0-#{Gem::Platform.local}", :path => default_bundle_path + system_gems "platform_specific-1.0-#{Gem::Platform.local}", path: default_bundle_path - install_gemfile <<-G, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, :artifice => "compact_index" + install_gemfile <<-G, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, artifice: "compact_index" source "#{file_uri_for(gem_repo4)}" gem "platform_specific", :force_ruby_platform => true diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index c79e275d2b..91038e00cb 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -39,7 +39,7 @@ RSpec.describe "bundle install from an existing gemspec" do end it "should install runtime and development dependencies" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("Gemfile", "source :rubygems\ngemspec") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" @@ -50,11 +50,11 @@ RSpec.describe "bundle install from an existing gemspec" do G expect(the_bundle).to include_gems "bar 1.0.0" - expect(the_bundle).to include_gems "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to include_gems "bar-dev 1.0.0", groups: :development end it "that is hidden should install runtime and development dependencies" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("Gemfile", "source :rubygems\ngemspec") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" @@ -67,7 +67,7 @@ RSpec.describe "bundle install from an existing gemspec" do G expect(the_bundle).to include_gems "bar 1.0.0" - expect(the_bundle).to include_gems "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to include_gems "bar-dev 1.0.0", groups: :development end it "should handle a list of requirements" do @@ -76,7 +76,7 @@ RSpec.describe "bundle install from an existing gemspec" do build_gem "baz", "1.1" end - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("Gemfile", "source :rubygems\ngemspec") s.add_dependency "baz", ">= 1.0", "< 1.1" end @@ -89,9 +89,9 @@ RSpec.describe "bundle install from an existing gemspec" do end it "should raise if there are no gemspecs available" do - build_lib("foo", :path => tmp.join("foo"), :gemspec => false) + build_lib("foo", path: tmp.join("foo"), gemspec: false) - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gemspec :path => '#{tmp.join("foo")}' G @@ -99,11 +99,11 @@ RSpec.describe "bundle install from an existing gemspec" do end it "should raise if there are too many gemspecs available" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("foo2.gemspec", build_spec("foo", "4.0").first.to_ruby) end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gemspec :path => '#{tmp.join("foo")}' G @@ -111,7 +111,7 @@ RSpec.describe "bundle install from an existing gemspec" do end it "should pick a specific gemspec" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("foo2.gemspec", "") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" @@ -123,11 +123,11 @@ RSpec.describe "bundle install from an existing gemspec" do G expect(the_bundle).to include_gems "bar 1.0.0" - expect(the_bundle).to include_gems "bar-dev 1.0.0", :groups => :development + expect(the_bundle).to include_gems "bar-dev 1.0.0", groups: :development end it "should use a specific group for development dependencies" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("foo2.gemspec", "") s.add_dependency "bar", "=1.0.0" s.add_development_dependency "bar-dev", "=1.0.0" @@ -139,32 +139,32 @@ RSpec.describe "bundle install from an existing gemspec" do G expect(the_bundle).to include_gems "bar 1.0.0" - expect(the_bundle).not_to include_gems "bar-dev 1.0.0", :groups => :development - expect(the_bundle).to include_gems "bar-dev 1.0.0", :groups => :dev + expect(the_bundle).not_to include_gems "bar-dev 1.0.0", groups: :development + expect(the_bundle).to include_gems "bar-dev 1.0.0", groups: :dev end it "should match a lockfile even if the gemspec defines development dependencies" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.write("Gemfile", "source '#{file_uri_for(gem_repo1)}'\ngemspec") s.add_dependency "actionpack", "=2.3.2" s.add_development_dependency "rake", "=13.0.1" end - bundle "install", :dir => tmp.join("foo") + bundle "install", dir: tmp.join("foo") # This should really be able to rely on $stderr, but, it's not written # right, so we can't. In fact, this is a bug negation test, and so it'll # ghost pass in future, and will only catch a regression if the message # doesn't change. Exit codes should be used correctly (they can be more # than just 0 and 1). bundle "config set --local deployment true" - output = bundle("install", :dir => tmp.join("foo")) + output = bundle("install", dir: tmp.join("foo")) expect(output).not_to match(/You have added to the Gemfile/) expect(output).not_to match(/You have deleted from the Gemfile/) expect(output).not_to match(/the lockfile can't be updated because frozen mode is set/) end it "should match a lockfile without needing to re-resolve" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.add_dependency "rack" end @@ -173,7 +173,7 @@ RSpec.describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}' G - bundle "install", :verbose => true + bundle "install", verbose: true message = "Found no changes, using resolution from the lockfile" expect(out.scan(message).size).to eq(1) @@ -182,7 +182,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "should match a lockfile without needing to re-resolve with development dependencies" do simulate_platform java - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.add_dependency "rack" s.add_development_dependency "thin" end @@ -192,34 +192,34 @@ RSpec.describe "bundle install from an existing gemspec" do gemspec :path => '#{tmp.join("foo")}' G - bundle "install", :verbose => true + bundle "install", verbose: true message = "Found no changes, using resolution from the lockfile" expect(out.scan(message).size).to eq(1) end it "should match a lockfile on non-ruby platforms with a transitive platform dependency", :jruby_only do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.add_dependency "platform_specific" end - system_gems "platform_specific-1.0-java", :path => default_bundle_path + system_gems "platform_specific-1.0-java", path: default_bundle_path install_gemfile <<-G gemspec :path => '#{tmp.join("foo")}' G - bundle "update --bundler", :artifice => "compact_index", :verbose => true + bundle "update --bundler", artifice: "compact_index", verbose: true expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 JAVA" end it "should evaluate the gemspec in its directory" do - build_lib("foo", :path => tmp.join("foo")) + build_lib("foo", path: tmp.join("foo")) File.open(tmp.join("foo/foo.gemspec"), "w") do |s| s.write "raise 'ahh' unless Dir.pwd == '#{tmp.join("foo")}'" end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false gemspec :path => '#{tmp.join("foo")}' G expect(last_command.stdboth).not_to include("ahh") @@ -233,7 +233,7 @@ RSpec.describe "bundle install from an existing gemspec" do # so emulate that system_gems %w[rack-1.0.0 rack-0.9.1 rack-obama-1.0] - build_lib("foo", :path => bundled_app) + build_lib("foo", path: bundled_app) gemspec = bundled_app("foo.gemspec").read bundled_app("foo.gemspec").open("w") do |f| f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }" @@ -248,14 +248,14 @@ RSpec.describe "bundle install from an existing gemspec" do end it "allows conflicts" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.version = "1.0.0" s.add_dependency "bar", "= 1.0.0" end - build_gem "deps", :to_bundle => true do |s| + build_gem "deps", to_bundle: true do |s| s.add_dependency "foo", "= 0.0.1" end - build_gem "foo", "0.0.1", :to_bundle => true + build_gem "foo", "0.0.1", to_bundle: true install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" @@ -267,7 +267,7 @@ RSpec.describe "bundle install from an existing gemspec" do end it "does not break Gem.finish_resolve with conflicts" do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.version = "1.0.0" s.add_dependency "bar", "= 1.0.0" end @@ -291,14 +291,14 @@ RSpec.describe "bundle install from an existing gemspec" do end it "handles downgrades" do - build_lib "omg", "2.0", :path => lib_path("omg") + build_lib "omg", "2.0", path: lib_path("omg") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gemspec :path => "#{lib_path("omg")}" G - build_lib "omg", "1.0", :path => lib_path("omg") + build_lib "omg", "1.0", path: lib_path("omg") bundle :install @@ -308,7 +308,7 @@ RSpec.describe "bundle install from an existing gemspec" do context "in deployment mode" do context "when the lockfile was not updated after a change to the gemspec's dependencies" do it "reports that installation failed" do - build_lib "cocoapods", :path => bundled_app do |s| + build_lib "cocoapods", path: bundled_app do |s| s.add_dependency "activesupport", ">= 1" end @@ -319,12 +319,12 @@ RSpec.describe "bundle install from an existing gemspec" do expect(the_bundle).to include_gems("cocoapods 1.0", "activesupport 2.3.5") - build_lib "cocoapods", :path => bundled_app do |s| + build_lib "cocoapods", path: bundled_app do |s| s.add_dependency "activesupport", ">= 1.0.1" end bundle "config set --local deployment true" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("changed") end @@ -334,13 +334,13 @@ RSpec.describe "bundle install from an existing gemspec" do context "when child gemspecs conflict with a released gemspec" do before do # build the "parent" gem that depends on another gem in the same repo - build_lib "source_conflict", :path => bundled_app do |s| + build_lib "source_conflict", path: bundled_app do |s| s.add_dependency "rack_middleware" end # build the "child" gem that is the same version as a released gem, but # has completely different and conflicting dependency requirements - build_lib "rack_middleware", "1.0", :path => bundled_app("rack_middleware") do |s| + build_lib "rack_middleware", "1.0", path: bundled_app("rack_middleware") do |s| s.add_dependency "rack", "1.0" # anything other than 0.9.1 end end @@ -359,7 +359,7 @@ RSpec.describe "bundle install from an existing gemspec" do let(:source_uri) { "http://localgemserver.test" } before do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.add_dependency "rack", "=1.0.0" end @@ -408,14 +408,14 @@ RSpec.describe "bundle install from an existing gemspec" do end it "should install" do - results = bundle "install", :artifice => "endpoint" + results = bundle "install", artifice: "endpoint" expect(results).to include("Installing rack 1.0.0") expect(the_bundle).to include_gems "rack 1.0.0" end end it "should install", :jruby do - results = bundle "install", :artifice => "endpoint" + results = bundle "install", artifice: "endpoint" expect(results).to include("Installing rack 1.0.0") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -430,7 +430,7 @@ RSpec.describe "bundle install from an existing gemspec" do end end - build_lib "foo", :path => bundled_app do |s| + build_lib "foo", path: bundled_app do |s| if platform_specific_type == :runtime s.add_runtime_dependency dependency elsif platform_specific_type == :development @@ -589,7 +589,7 @@ RSpec.describe "bundle install from an existing gemspec" do context "with multiple platforms" do before do - build_lib("foo", :path => tmp.join("foo")) do |s| + build_lib("foo", path: tmp.join("foo")) do |s| s.version = "1.0.0" s.add_development_dependency "rack" s.write "foo-universal-java.gemspec", build_spec("foo", "1.0.0", "universal-java") {|sj| sj.runtime "rack", "1.0.0" }.first.to_ruby @@ -623,7 +623,7 @@ RSpec.describe "bundle install from an existing gemspec" do context "with multiple platforms and resolving for more specific platforms" do before do - build_lib("chef", :path => tmp.join("chef")) do |s| + build_lib("chef", path: tmp.join("chef")) do |s| s.version = "17.1.17" s.write "chef-universal-mingw32.gemspec", build_spec("chef", "17.1.17", "universal-mingw32") {|sw| sw.runtime "win32-api", "~> 1.5.3" }.first.to_ruby end @@ -682,7 +682,7 @@ RSpec.describe "bundle install from an existing gemspec" do context "with multiple locked platforms" do before do - build_lib("activeadmin", :path => tmp.join("activeadmin")) do |s| + build_lib("activeadmin", path: tmp.join("activeadmin")) do |s| s.version = "2.9.0" s.add_dependency "railties", ">= 5.2", "< 6.2" end diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index b07afaaffb..9130483aa1 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -26,8 +26,8 @@ RSpec.describe "bundle install with git sources" do expect(out).to eq("WIN") end - it "caches the git repo", :bundler => "< 3" do - expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes :size => 1 + it "caches the git repo", bundler: "< 3" do + expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have_attributes size: 1 end it "does not write to cache on bundler/setup" do @@ -41,7 +41,7 @@ RSpec.describe "bundle install with git sources" do simulate_new_machine bundle "config set global_gem_cache true" bundle :install - expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1 + expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes size: 1 bundle "install --verbose" expect(err).to be_empty @@ -69,7 +69,7 @@ RSpec.describe "bundle install with git sources" do it "does not update the git source implicitly" do update_git "foo" - install_gemfile bundled_app2("Gemfile"), <<-G, :dir => bundled_app2 + install_gemfile bundled_app2("Gemfile"), <<-G, dir: bundled_app2 source "#{file_uri_for(gem_repo1)}" git "#{lib_path("foo-1.0")}" do gem 'foo' @@ -92,7 +92,7 @@ RSpec.describe "bundle install with git sources" do it "complains if pinned specs don't exist in the git repo" do build_git "foo" - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}" G @@ -105,7 +105,7 @@ RSpec.describe "bundle install with git sources" do s.platform = "java" end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" platforms :jruby do gem "only_java", "1.2", :git => "#{lib_path("only_java-1.0-java")}" @@ -125,7 +125,7 @@ RSpec.describe "bundle install with git sources" do s.write "only_java1-0.gemspec", File.read("#{lib_path("only_java-1.0-java")}/only_java.gemspec") end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" platforms :jruby do gem "only_java", "1.2", :git => "#{lib_path("only_java-1.1-java")}" @@ -141,7 +141,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.mv bundled_app, tmp("bundled_app.bck") - expect(the_bundle).to include_gems "foo 1.0", :dir => tmp("bundled_app.bck") + expect(the_bundle).to include_gems "foo 1.0", dir: tmp("bundled_app.bck") end it "can still install after moving the application directory" do @@ -150,7 +150,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.mv bundled_app, tmp("bundled_app.bck") - update_git "foo", "1.1", :path => lib_path("foo-1.0") + update_git "foo", "1.1", path: lib_path("foo-1.0") gemfile tmp("bundled_app.bck/Gemfile"), <<-G source "#{file_uri_for(gem_repo1)}" @@ -161,9 +161,9 @@ RSpec.describe "bundle install with git sources" do gem "rack", "1.0" G - bundle "update foo", :dir => tmp("bundled_app.bck") + bundle "update foo", dir: tmp("bundled_app.bck") - expect(the_bundle).to include_gems "foo 1.1", "rack 1.0", :dir => tmp("bundled_app.bck") + expect(the_bundle).to include_gems "foo 1.1", "rack 1.0", dir: tmp("bundled_app.bck") end end @@ -245,9 +245,9 @@ RSpec.describe "bundle install with git sources" do it "works when a tag that does not look like a commit hash is used as the value of :ref" do build_git "foo" - @remote = build_git("bar", :bare => true) - update_git "foo", :remote => file_uri_for(@remote.path) - update_git "foo", :push => "main" + @remote = build_git("bar", bare: true) + update_git "foo", remote: file_uri_for(@remote.path) + update_git "foo", push: "main" install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -255,8 +255,8 @@ RSpec.describe "bundle install with git sources" do G # Create a new tag on the remote that needs fetching - update_git "foo", :tag => "v1.0.0" - update_git "foo", :push => "v1.0.0" + update_git "foo", tag: "v1.0.0" + update_git "foo", push: "v1.0.0" install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -268,14 +268,14 @@ RSpec.describe "bundle install with git sources" do it "works when the revision is a non-head ref" do # want to ensure we don't fallback to main - update_git "foo", :path => lib_path("foo-1.0") do |s| + update_git "foo", path: lib_path("foo-1.0") do |s| s.write("lib/foo.rb", "raise 'FAIL'") end - sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0")) + sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", dir: lib_path("foo-1.0")) # want to ensure we don't fallback to HEAD - update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s| + update_git "foo", path: lib_path("foo-1.0"), branch: "rando" do |s| s.write("lib/foo.rb", "raise 'FAIL_FROM_RANDO'") end @@ -304,14 +304,14 @@ RSpec.describe "bundle install with git sources" do G # want to ensure we don't fallback to main - update_git "foo", :path => lib_path("foo-1.0") do |s| + update_git "foo", path: lib_path("foo-1.0") do |s| s.write("lib/foo.rb", "raise 'FAIL'") end - sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0")) + sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", dir: lib_path("foo-1.0")) # want to ensure we don't fallback to HEAD - update_git "foo", :path => lib_path("foo-1.0"), :branch => "rando" do |s| + update_git "foo", path: lib_path("foo-1.0"), branch: "rando" do |s| s.write("lib/foo.rb", "raise 'FAIL_FROM_RANDO'") end @@ -332,7 +332,7 @@ RSpec.describe "bundle install with git sources" do end it "does not download random non-head refs" do - sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", :dir => lib_path("foo-1.0")) + sys_exec("git update-ref -m \"Bundler Spec!\" refs/bundler/1 main~1", dir: lib_path("foo-1.0")) bundle "config set global_gem_cache true" @@ -344,9 +344,9 @@ RSpec.describe "bundle install with git sources" do G # ensure we also git fetch after cloning - bundle :update, :all => true + bundle :update, all: true - sys_exec("git ls-remote .", :dir => Dir[home(".bundle/cache/git/foo-*")].first) + sys_exec("git ls-remote .", dir: Dir[home(".bundle/cache/git/foo-*")].first) expect(out).not_to include("refs/bundler/1") end @@ -357,7 +357,7 @@ RSpec.describe "bundle install with git sources" do let(:repo) { build_git("foo").path } it "works" do - update_git("foo", :path => repo, :branch => branch) + update_git("foo", path: repo, branch: branch) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -374,7 +374,7 @@ RSpec.describe "bundle install with git sources" do it "works" do skip "git does not accept this" if Gem.win_platform? - update_git("foo", :path => repo, :branch => branch) + update_git("foo", path: repo, branch: branch) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -392,7 +392,7 @@ RSpec.describe "bundle install with git sources" do it "works" do skip "git does not accept this" if Gem.win_platform? - update_git("foo", :path => repo, :branch => branch) + update_git("foo", path: repo, branch: branch) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -411,7 +411,7 @@ RSpec.describe "bundle install with git sources" do let(:repo) { build_git("foo").path } it "works" do - update_git("foo", :path => repo, :tag => tag) + update_git("foo", path: repo, tag: tag) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -428,7 +428,7 @@ RSpec.describe "bundle install with git sources" do it "works" do skip "git does not accept this" if Gem.win_platform? - update_git("foo", :path => repo, :tag => tag) + update_git("foo", path: repo, tag: tag) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -446,7 +446,7 @@ RSpec.describe "bundle install with git sources" do it "works" do skip "git does not accept this" if Gem.win_platform? - update_git("foo", :path => repo, :tag => tag) + update_git("foo", path: repo, tag: tag) install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -462,7 +462,7 @@ RSpec.describe "bundle install with git sources" do describe "when specifying local override" do it "uses the local repository instead of checking a new one out" do - build_git "rack", "0.8", :path => lib_path("local-rack") do |s| + build_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -483,7 +483,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", :path => lib_path("local-rack") do |s| + update_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -502,7 +502,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", :path => lib_path("local-rack") do |s| + update_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "rack.gemspec", build_spec("rack", "0.8") { runtime "rspec", "> 0" }.first.to_ruby s.write "lib/rack.rb", "puts :LOCAL" end @@ -531,7 +531,7 @@ RSpec.describe "bundle install with git sources" do lockfile0 = File.read(bundled_app_lock) FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", :path => lib_path("local-rack") do |s| + update_git "rack", "0.8", path: lib_path("local-rack") do |s| s.add_dependency "nokogiri", "1.4.2" end @@ -553,7 +553,7 @@ RSpec.describe "bundle install with git sources" do lockfile0 = File.read(bundled_app_lock) FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", :path => lib_path("local-rack") + update_git "rack", "0.8", path: lib_path("local-rack") bundle %(config set local.rack #{lib_path("local-rack")}) bundle :install @@ -571,7 +571,7 @@ RSpec.describe "bundle install with git sources" do G bundle %(config set local.rack #{lib_path("local-rack")}) - bundle :install, :raise_on_error => false + bundle :install, 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/) solution = "config unset local.rack" @@ -593,7 +593,7 @@ RSpec.describe "bundle install with git sources" do G bundle %(config set local.rack #{lib_path("local-rack")}) - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/Cannot use local override for rack-0.8 at #{Regexp.escape(lib_path("local-rack").to_s)} because :branch is not specified in Gemfile/) solution = "config unset local.rack" @@ -625,7 +625,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack")) - update_git "rack", "0.8", :path => lib_path("local-rack"), :branch => "another" do |s| + update_git "rack", "0.8", path: lib_path("local-rack"), branch: "another" do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -635,14 +635,14 @@ RSpec.describe "bundle install with git sources" do G bundle %(config set local.rack #{lib_path("local-rack")}) - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/is using branch another but Gemfile specifies main/) end it "explodes on invalid revision on install" do build_git "rack", "0.8" - build_git "rack", "0.8", :path => lib_path("local-rack") do |s| + build_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -652,14 +652,14 @@ RSpec.describe "bundle install with git sources" do G bundle %(config set local.rack #{lib_path("local-rack")}) - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/The Gemfile lock is pointing to revision \w+/) end it "does not explode on invalid revision on install" do build_git "rack", "0.8" - build_git "rack", "0.8", :path => lib_path("local-rack") do |s| + build_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -706,11 +706,11 @@ RSpec.describe "bundle install with git sources" do it "installs dependencies from git even if a newer gem is available elsewhere" do system_gems "rack-1.0.0" - build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s| + build_lib "rack", "1.0", path: lib_path("nested/bar") do |s| s.write "lib/rack.rb", "puts 'WIN OVERRIDE'" end - build_git "foo", :path => lib_path("nested") do |s| + build_git "foo", path: lib_path("nested") do |s| s.add_dependency "rack", "= 1.0" end @@ -729,7 +729,7 @@ RSpec.describe "bundle install with git sources" do gem "rack", "0.9.1" G - build_git "rack", :path => lib_path("rack") + build_git "rack", path: lib_path("rack") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -745,7 +745,7 @@ RSpec.describe "bundle install with git sources" do gem "rack" G - build_git "rack", "1.2", :path => lib_path("rack") + build_git "rack", "1.2", path: lib_path("rack") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -758,8 +758,8 @@ RSpec.describe "bundle install with git sources" do describe "block syntax" do it "pulls all gems from a git block" do - build_lib "omg", :path => lib_path("hi2u/omg") - build_lib "hi2u", :path => lib_path("hi2u") + build_lib "omg", path: lib_path("hi2u/omg") + build_lib "hi2u", path: lib_path("hi2u") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -807,7 +807,7 @@ RSpec.describe "bundle install with git sources" do end it "runs the gemspec in the context of its parent directory" do - build_lib "bar", :path => lib_path("foo/bar"), :gemspec => false do |s| + build_lib "bar", path: lib_path("foo/bar"), gemspec: false do |s| s.write lib_path("foo/bar/lib/version.rb"), %(BAR_VERSION = '1.0') s.write "bar.gemspec", <<-G $:.unshift Dir.pwd @@ -822,7 +822,7 @@ RSpec.describe "bundle install with git sources" do G end - build_git "foo", :path => lib_path("foo") do |s| + build_git "foo", path: lib_path("foo") do |s| s.write "bin/foo", "" end @@ -837,7 +837,7 @@ RSpec.describe "bundle install with git sources" do end it "installs from git even if a rubygems gem is present" do - build_gem "foo", "1.0", :path => lib_path("fake_foo"), :to_system => true do |s| + build_gem "foo", "1.0", path: lib_path("fake_foo"), to_system: true do |s| s.write "lib/foo.rb", "raise 'FAIL'" end @@ -852,7 +852,7 @@ RSpec.describe "bundle install with git sources" do end it "fakes the gem out if there is no gemspec" do - build_git "foo", :gemspec => false + build_git "foo", gemspec: false install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -870,7 +870,7 @@ RSpec.describe "bundle install with git sources" do gem "foo", "1.0", :git => "omgomg" G - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("Git error:") expect(err).to include("fatal") @@ -878,7 +878,7 @@ RSpec.describe "bundle install with git sources" do end it "works when the gem path has spaces in it" do - build_git "foo", :path => lib_path("foo space-1.0") + build_git "foo", path: lib_path("foo space-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -903,12 +903,12 @@ RSpec.describe "bundle install with git sources" do s.write "lib/forced.rb", "FORCED = '1.1'" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "forced 1.1" - sys_exec("git reset --hard HEAD^", :dir => lib_path("forced-1.0")) + sys_exec("git reset --hard HEAD^", dir: lib_path("forced-1.0")) - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "forced 1.0" end @@ -920,10 +920,10 @@ RSpec.describe "bundle install with git sources" do build_git "has_submodule", "1.0" do |s| s.add_dependency "submodule" end - sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0") - sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0") + sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", dir: lib_path("has_submodule-1.0") + sys_exec "git commit -m \"submodulator\"", dir: lib_path("has_submodule-1.0") - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" git "#{lib_path("has_submodule-1.0")}" do gem "has_submodule" @@ -942,8 +942,8 @@ RSpec.describe "bundle install with git sources" do build_git "has_submodule", "1.0" do |s| s.add_dependency "submodule" end - sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0") - sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0") + sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", dir: lib_path("has_submodule-1.0") + sys_exec "git commit -m \"submodulator\"", dir: lib_path("has_submodule-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -962,8 +962,8 @@ RSpec.describe "bundle install with git sources" do build_git "submodule", "1.0" build_git "has_submodule", "1.0" - sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0") - sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0") + sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", dir: lib_path("has_submodule-1.0") + sys_exec "git commit -m \"submodulator\"", dir: lib_path("has_submodule-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1037,7 +1037,7 @@ RSpec.describe "bundle install with git sources" do FileUtils.mkdir_p(default_bundle_path) FileUtils.touch(default_bundle_path("bundler")) - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1049,11 +1049,11 @@ RSpec.describe "bundle install with git sources" do end it "does not duplicate git gem sources" do - build_lib "foo", :path => lib_path("nested/foo") - build_lib "bar", :path => lib_path("nested/bar") + build_lib "foo", path: lib_path("nested/foo") + build_lib "bar", path: lib_path("nested/bar") - build_git "foo", :path => lib_path("nested") - build_git "bar", :path => lib_path("nested") + build_git "foo", path: lib_path("nested") + build_git "bar", path: lib_path("nested") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1066,11 +1066,11 @@ RSpec.describe "bundle install with git sources" do describe "switching sources" do it "doesn't explode when switching Path to Git sources" do - build_gem "foo", "1.0", :to_system => true do |s| + build_gem "foo", "1.0", to_system: true do |s| s.write "lib/foo.rb", "raise 'fail'" end - build_lib "foo", "1.0", :path => lib_path("bar/foo") - build_git "bar", "1.0", :path => lib_path("bar") do |s| + build_lib "foo", "1.0", path: lib_path("bar/foo") + build_git "bar", "1.0", path: lib_path("bar") do |s| s.add_dependency "foo" end @@ -1145,7 +1145,7 @@ RSpec.describe "bundle install with git sources" do G expect(out).to_not match(/Revision.*does not exist/) - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "deadbeef" G @@ -1155,7 +1155,7 @@ RSpec.describe "bundle install with git sources" do it "gives a helpful error message when the remote branch no longer exists" do build_git "foo" - install_gemfile <<-G, :env => { "LANG" => "en" }, :raise_on_error => false + install_gemfile <<-G, env: { "LANG" => "en" }, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :branch => "deadbeef" G @@ -1166,7 +1166,7 @@ RSpec.describe "bundle install with git sources" do describe "bundle install with deployment mode configured and git sources" do it "works" do - build_git "valim", :path => lib_path("valim") + build_git "valim", path: lib_path("valim") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1197,7 +1197,7 @@ RSpec.describe "bundle install with git sources" do end bundle :install, - :requires => [lib_path("install_hooks.rb")] + requires: [lib_path("install_hooks.rb")] expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0") end @@ -1217,7 +1217,7 @@ RSpec.describe "bundle install with git sources" do end bundle :install, - :requires => [lib_path("install_hooks.rb")] + requires: [lib_path("install_hooks.rb")] expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0") end @@ -1236,7 +1236,7 @@ RSpec.describe "bundle install with git sources" do H end - bundle :install, :requires => [lib_path("install_hooks.rb")], :raise_on_error => false + bundle :install, requires: [lib_path("install_hooks.rb")], raise_on_error: false expect(err).to include("failed for foo-1.0") end end @@ -1275,7 +1275,7 @@ RSpec.describe "bundle install with git sources" do end it "does not use old extension after ref changes" do - git_reader = build_git "foo", :no_default => true do |s| + git_reader = build_git "foo", no_default: true do |s| s.extensions = ["ext/extconf.rb"] s.write "ext/extconf.rb", <<-RUBY require "mkmf" @@ -1293,7 +1293,7 @@ RSpec.describe "bundle install with git sources" do void Init_foo() { rb_define_global_function("foo", &foo, 0); } C end - sys_exec("git commit -m \"commit for iteration #{i}\" ext/foo.c", :dir => git_reader.path) + sys_exec("git commit -m \"commit for iteration #{i}\" ext/foo.c", dir: git_reader.path) git_commit_sha = git_reader.ref_for("HEAD") @@ -1322,7 +1322,7 @@ RSpec.describe "bundle install with git sources" do RUBY end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{lib_path("foo-1.0")}" G @@ -1448,7 +1448,7 @@ In Gemfile: installed_time = out - update_git("foo", :branch => "branch2") + update_git("foo", branch: "branch2") expect(installed_time).to match(/\A\d+\.\d+\z/) @@ -1527,7 +1527,7 @@ In Gemfile: L with_path_as("") do - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false end expect(err). to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git") @@ -1544,7 +1544,7 @@ In Gemfile: G with_path_as("") do - bundle "update", :all => true, :raise_on_error => false + bundle "update", all: true, raise_on_error: false end expect(err). to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git") @@ -1563,7 +1563,7 @@ In Gemfile: bundle :cache simulate_new_machine - bundle "install", :env => { "PATH" => "" } + bundle "install", env: { "PATH" => "" } expect(out).to_not include("You need to install git to be able to use gems from git repositories.") end end @@ -1581,7 +1581,7 @@ In Gemfile: end it "installs successfully" do - build_git "foo", "1.0", :path => lib_path("foo") + build_git "foo", "1.0", path: lib_path("foo") gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -1599,7 +1599,7 @@ In Gemfile: let(:credentials) { "user1:password1" } it "does not display the password" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" git "https://#{credentials}@github.com/company/private-repo" do gem "foo" @@ -1615,7 +1615,7 @@ In Gemfile: let(:credentials) { "oauth_token" } it "displays the oauth scheme but not the oauth token" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" git "https://#{credentials}:[email protected]/company/private-repo" do gem "foo" diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb index 5dd39ee921..f7907a9cad 100644 --- a/spec/bundler/install/gemfile/groups_spec.rb +++ b/spec/bundler/install/gemfile/groups_spec.rb @@ -88,32 +88,32 @@ RSpec.describe "bundle install with groups" do it "installs gems in the default group" do bundle "config set --local without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] + expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] end it "respects global `without` configuration, but does not save it locally" do bundle "config set --global without emo" bundle :install - expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] + expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] bundle "config list" expect(out).not_to include("Set for your local app (#{bundled_app(".bundle/config")}): [:emo]") expect(out).to include("Set for the current user (#{home(".bundle/config")}): [:emo]") end - it "allows running application where groups where configured by a different user", :bundler => "< 3" do + it "allows running application where groups where configured by a different user", bundler: "< 3" do bundle "config set without emo" bundle :install - bundle "exec ruby -e 'puts 42'", :env => { "BUNDLE_USER_HOME" => tmp("new_home").to_s } + bundle "exec ruby -e 'puts 42'", env: { "BUNDLE_USER_HOME" => tmp("new_home").to_s } expect(out).to include("42") end it "does not install gems from the excluded group" do bundle "config set --local without emo" bundle :install - expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default] + expect(the_bundle).not_to include_gems "activesupport 2.3.5", groups: [:default] end - it "remembers previous exclusion with `--without`", :bundler => "< 3" do + it "remembers previous exclusion with `--without`", bundler: "< 3" do bundle "install --without emo" expect(the_bundle).not_to include_gems "activesupport 2.3.5" bundle :install @@ -144,7 +144,7 @@ RSpec.describe "bundle install with groups" do bundle "config set --local without emo" bundle :install - 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 "still works when BUNDLE_WITHOUT is set" do @@ -153,20 +153,20 @@ RSpec.describe "bundle install with groups" do bundle :install expect(out).not_to include("activesupport") - expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default] - expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default] + expect(the_bundle).to include_gems "rack 1.0.0", groups: [:default] + expect(the_bundle).not_to include_gems "activesupport 2.3.5", groups: [:default] ENV["BUNDLE_WITHOUT"] = nil end - it "clears --without when passed an empty list", :bundler => "< 3" do + it "clears --without when passed an empty list", bundler: "< 3" do bundle "install --without emo" bundle "install --without ''" expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "doesn't clear without when nothing is passed", :bundler => "< 3" do + it "doesn't clear without when nothing is passed", bundler: "< 3" do bundle "install --without emo" bundle :install @@ -184,7 +184,7 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).to include_gems "thin 1.0" end - it "installs gems from the previously requested group", :bundler => "< 3" do + it "installs gems from the previously requested group", bundler: "< 3" do bundle "install --with debugging" expect(the_bundle).to include_gems "thin 1.0" bundle :install @@ -198,26 +198,26 @@ RSpec.describe "bundle install with groups" do ENV["BUNDLE_WITH"] = nil end - it "clears --with when passed an empty list", :bundler => "< 3" do + it "clears --with when passed an empty list", bundler: "< 3" do bundle "install --with debugging" bundle "install --with ''" expect(the_bundle).not_to include_gems "thin 1.0" end - it "removes groups from without when passed at --with", :bundler => "< 3" do + it "removes groups from without when passed at --with", bundler: "< 3" do bundle "config set --local without emo" bundle "install --with emo" expect(the_bundle).to include_gems "activesupport 2.3.5" end - it "removes groups from with when passed at --without", :bundler => "< 3" do + it "removes groups from with when passed at --without", bundler: "< 3" do bundle "config set --local with debugging" - bundle "install --without debugging", :raise_on_error => false + bundle "install --without debugging", raise_on_error: false expect(the_bundle).not_to include_gem "thin 1.0" end - it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do - bundle "install --with emo debugging --without emo", :raise_on_error => false + it "errors out when passing a group to with and without via CLI flags", bundler: "< 3" do + bundle "install --with emo debugging --without emo", raise_on_error: false expect(last_command).to be_failure expect(err).to include("The offending groups are: emo") end @@ -235,7 +235,7 @@ RSpec.describe "bundle install with groups" do expect(the_bundle).to include_gem "thin 1.0" end - it "can add and remove a group at the same time", :bundler => "< 3" do + it "can add and remove a group at the same time", bundler: "< 3" do bundle "install --with debugging --without emo" expect(the_bundle).to include_gems "thin 1.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" @@ -396,7 +396,7 @@ RSpec.describe "bundle install with groups" do it "does not hit the remote a second time" do FileUtils.rm_rf gem_repo2 bundle "config set --local without rack" - bundle :install, :verbose => true + bundle :install, verbose: true expect(last_command.stdboth).not_to match(/fetching/i) end end diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index d6e008a7c4..7f11b04408 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe "bundle install with explicit source paths" do - it "fetches gems with a global path source", :bundler => "< 3" do + it "fetches gems with a global path source", bundler: "< 3" do build_lib "foo" install_gemfile <<-G @@ -69,7 +69,7 @@ RSpec.describe "bundle install with explicit source paths" do username = "some_unexisting_user" relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path) - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem 'foo', :path => "~#{username}/#{relative_path}" G @@ -78,19 +78,19 @@ RSpec.describe "bundle install with explicit source paths" do end it "expands paths relative to Bundler.root" do - build_lib "foo", :path => bundled_app("foo-1.0") + build_lib "foo", path: bundled_app("foo-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem 'foo', :path => "./foo-1.0" G - expect(the_bundle).to include_gems("foo 1.0", :dir => bundled_app("subdir").mkpath) + expect(the_bundle).to include_gems("foo 1.0", dir: bundled_app("subdir").mkpath) end it "sorts paths consistently on install and update when they start with ./" do - build_lib "demo", :path => lib_path("demo") - build_lib "aaa", :path => lib_path("demo/aaa") + build_lib "demo", path: lib_path("demo") + build_lib "aaa", path: lib_path("demo/aaa") gemfile lib_path("demo/Gemfile"), <<-G source "#{file_uri_for(gem_repo1)}" @@ -129,14 +129,14 @@ RSpec.describe "bundle install with explicit source paths" do #{Bundler::VERSION} L - bundle :install, :dir => lib_path("demo") + bundle :install, dir: lib_path("demo") expect(lib_path("demo/Gemfile.lock")).to read_as(lockfile) - bundle :update, :all => true, :dir => lib_path("demo") + bundle :update, all: true, dir: lib_path("demo") expect(lib_path("demo/Gemfile.lock")).to read_as(lockfile) end it "expands paths when comparing locked paths to Gemfile paths" do - build_lib "foo", :path => bundled_app("foo-1.0") + build_lib "foo", path: bundled_app("foo-1.0") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -150,11 +150,11 @@ RSpec.describe "bundle install with explicit source paths" do it "installs dependencies from the path even if a newer gem is available elsewhere" do system_gems "rack-1.0.0" - build_lib "rack", "1.0", :path => lib_path("nested/bar") do |s| + build_lib "rack", "1.0", path: lib_path("nested/bar") do |s| s.write "lib/rack.rb", "puts 'WIN OVERRIDE'" end - build_lib "foo", :path => lib_path("nested") do |s| + build_lib "foo", path: lib_path("nested") do |s| s.add_dependency "rack", "= 1.0" end @@ -168,15 +168,15 @@ RSpec.describe "bundle install with explicit source paths" do end it "works" do - build_gem "foo", "1.0.0", :to_system => true do |s| + build_gem "foo", "1.0.0", to_system: true do |s| s.write "lib/foo.rb", "puts 'FAIL'" end - build_lib "omg", "1.0", :path => lib_path("omg") do |s| + build_lib "omg", "1.0", path: lib_path("omg") do |s| s.add_dependency "foo" end - build_lib "foo", "1.0.0", :path => lib_path("omg/foo") + build_lib "foo", "1.0.0", path: lib_path("omg/foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -187,7 +187,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "works when using prereleases of 0.0.0" do - build_lib "foo", "0.0.0.dev", :path => lib_path("foo") + build_lib "foo", "0.0.0.dev", path: lib_path("foo") gemfile <<~G source "#{file_uri_for(gem_repo1)}" @@ -220,7 +220,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "works when using uppercase prereleases of 0.0.0" do - build_lib "foo", "0.0.0.SNAPSHOT", :path => lib_path("foo") + build_lib "foo", "0.0.0.SNAPSHOT", path: lib_path("foo") gemfile <<~G source "#{file_uri_for(gem_repo1)}" @@ -253,14 +253,14 @@ RSpec.describe "bundle install with explicit source paths" do end it "handles downgrades" do - build_lib "omg", "2.0", :path => lib_path("omg") + build_lib "omg", "2.0", path: lib_path("omg") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "omg", :path => "#{lib_path("omg")}" G - build_lib "omg", "1.0", :path => lib_path("omg") + build_lib "omg", "1.0", path: lib_path("omg") bundle :install @@ -268,7 +268,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "prefers gemspecs closer to the path root" do - build_lib "premailer", "1.0.0", :path => lib_path("premailer") do |s| + build_lib "premailer", "1.0.0", path: lib_path("premailer") do |s| s.write "gemfiles/ruby187.gemspec", <<-G Gem::Specification.new do |s| s.name = 'premailer' @@ -301,7 +301,7 @@ RSpec.describe "bundle install with explicit source paths" do G end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "foo", :path => "#{lib_path("foo-1.0")}" G @@ -313,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "supports gemspec syntax" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "1.0" end @@ -322,9 +322,9 @@ RSpec.describe "bundle install with explicit source paths" do gemspec G - bundle "install", :dir => lib_path("foo") - expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo") + bundle "install", dir: lib_path("foo") + expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") end it "does not unlock dependencies of path sources" do @@ -333,7 +333,7 @@ RSpec.describe "bundle install with explicit source paths" do build_gem "graphql", "2.0.16" end - build_lib "foo", "0.1.0", :path => lib_path("foo") do |s| + build_lib "foo", "0.1.0", path: lib_path("foo") do |s| s.add_dependency "graphql", "~> 2.0" end @@ -375,16 +375,16 @@ RSpec.describe "bundle install with explicit source paths" do lockfile lockfile_path, original_lockfile - build_lib "foo", "0.1.1", :path => lib_path("foo") do |s| + build_lib "foo", "0.1.1", path: lib_path("foo") do |s| s.add_dependency "graphql", "~> 2.0" end - bundle "install", :dir => lib_path("foo") + bundle "install", dir: lib_path("foo") expect(lockfile_path).to read_as(original_lockfile.gsub("foo (0.1.0)", "foo (0.1.1)")) end it "supports gemspec syntax with an alternative path" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "1.0" end @@ -398,48 +398,48 @@ RSpec.describe "bundle install with explicit source paths" do end it "doesn't automatically unlock dependencies when using the gemspec syntax" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", ">= 1.0" end - install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo") + install_gemfile lib_path("foo/Gemfile"), <<-G, dir: lib_path("foo") source "#{file_uri_for(gem_repo1)}" gemspec G - build_gem "rack", "1.0.1", :to_system => true + build_gem "rack", "1.0.1", to_system: true - bundle "install", :dir => lib_path("foo") + bundle "install", dir: lib_path("foo") - expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo") + expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") end it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", ">= 1.0" s.add_development_dependency "activesupport" end - install_gemfile lib_path("foo/Gemfile"), <<-G, :dir => lib_path("foo") + install_gemfile lib_path("foo/Gemfile"), <<-G, dir: lib_path("foo") source "#{file_uri_for(gem_repo1)}" gemspec G - build_gem "rack", "1.0.1", :to_system => true + build_gem "rack", "1.0.1", to_system: true - bundle "install", :dir => lib_path("foo") + bundle "install", dir: lib_path("foo") - expect(the_bundle).to include_gems "foo 1.0", :dir => lib_path("foo") - expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("foo") + expect(the_bundle).to include_gems "foo 1.0", dir: lib_path("foo") + expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("foo") end it "raises if there are multiple gemspecs" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.write "bar.gemspec", build_spec("bar", "1.0").first.to_ruby end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gemspec :path => "#{lib_path("foo")}" G @@ -449,7 +449,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "allows :name to be specified to resolve ambiguity" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.write "bar.gemspec" end @@ -466,7 +466,7 @@ RSpec.describe "bundle install with explicit source paths" do s.executables = "foobar" end - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" path "#{lib_path("foo-1.0")}" do gem 'foo' @@ -520,9 +520,9 @@ RSpec.describe "bundle install with explicit source paths" do end it "keeps source pinning" do - build_lib "foo", "1.0", :path => lib_path("foo") - build_lib "omg", "1.0", :path => lib_path("omg") - build_lib "foo", "1.0", :path => lib_path("omg/foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") + build_lib "omg", "1.0", path: lib_path("omg") + build_lib "foo", "1.0", path: lib_path("omg/foo") do |s| s.write "lib/foo.rb", "puts 'FAIL'" end @@ -536,7 +536,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "works when the path does not have a gemspec" do - build_lib "foo", :gemspec => false + build_lib "foo", gemspec: false gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -574,17 +574,17 @@ RSpec.describe "bundle install with explicit source paths" do gem 'net-ssh', '1.0' G - bundle :check, :env => { "DEBUG" => "1" } + bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" end it "source path gems w/deps don't re-resolve without changes" do - build_lib "rack-obama", "1.0", :path => lib_path("omg") do |s| + build_lib "rack-obama", "1.0", path: lib_path("omg") do |s| s.add_dependency "yard" end - build_lib "net-ssh", "1.0", :path => lib_path("omg") do |s| + build_lib "net-ssh", "1.0", path: lib_path("omg") do |s| s.add_dependency "yard" end @@ -594,7 +594,7 @@ RSpec.describe "bundle install with explicit source paths" do gem 'net-ssh', :path => "#{lib_path("omg")}" G - bundle :check, :env => { "DEBUG" => "1" } + bundle :check, env: { "DEBUG" => "1" } expect(out).to match(/using resolution from the lockfile/) expect(the_bundle).to include_gems "rack-obama 1.0", "net-ssh 1.0" end @@ -616,10 +616,10 @@ RSpec.describe "bundle install with explicit source paths" do describe "when the gem version in the path is updated" do before :each do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "bar" end - build_lib "bar", "1.0", :path => lib_path("foo/bar") + build_lib "bar", "1.0", path: lib_path("foo/bar") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -628,7 +628,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "unlocks all gems when the top level gem is updated" do - build_lib "foo", "2.0", :path => lib_path("foo") do |s| + build_lib "foo", "2.0", path: lib_path("foo") do |s| s.add_dependency "bar" end @@ -638,7 +638,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "unlocks all gems when a child dependency gem is updated" do - build_lib "bar", "2.0", :path => lib_path("foo/bar") + build_lib "bar", "2.0", path: lib_path("foo/bar") bundle "install" @@ -648,7 +648,7 @@ RSpec.describe "bundle install with explicit source paths" do describe "when dependencies in the path are updated" do before :each do - build_lib "foo", "1.0", :path => lib_path("foo") + build_lib "foo", "1.0", path: lib_path("foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -657,7 +657,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "gets dependencies that are updated in the path" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack" end @@ -667,7 +667,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "keeps using the same version if it's compatible" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "0.9.1" end @@ -702,7 +702,7 @@ RSpec.describe "bundle install with explicit source paths" do #{Bundler::VERSION} G - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack" end @@ -734,7 +734,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "keeps using the same version even when another dependency is added" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "0.9.1" end @@ -769,7 +769,7 @@ RSpec.describe "bundle install with explicit source paths" do #{Bundler::VERSION} G - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack" s.add_dependency "rake", "13.0.1" end @@ -806,7 +806,7 @@ RSpec.describe "bundle install with explicit source paths" do end it "does not remove existing ruby platform" do - build_lib "foo", "1.0", :path => lib_path("foo") do |s| + build_lib "foo", "1.0", path: lib_path("foo") do |s| s.add_dependency "rack", "0.9.1" end @@ -860,11 +860,11 @@ RSpec.describe "bundle install with explicit source paths" do describe "switching sources" do it "doesn't switch pinned git sources to rubygems when pinning the parent gem to a path source" do - build_gem "foo", "1.0", :to_system => true do |s| + build_gem "foo", "1.0", to_system: true do |s| s.write "lib/foo.rb", "raise 'fail'" end - build_lib "foo", "1.0", :path => lib_path("bar/foo") - build_git "bar", "1.0", :path => lib_path("bar") do |s| + build_lib "foo", "1.0", path: lib_path("bar/foo") + build_git "bar", "1.0", path: lib_path("bar") do |s| s.add_dependency "foo" end @@ -882,8 +882,8 @@ RSpec.describe "bundle install with explicit source paths" do end it "switches the source when the gem existed in rubygems and the path was already being used for another gem" do - build_lib "foo", "1.0", :path => lib_path("foo") - build_gem "bar", "1.0", :to_bundle => true do |s| + build_lib "foo", "1.0", path: lib_path("foo") + build_gem "bar", "1.0", to_bundle: true do |s| s.write "lib/bar.rb", "raise 'fail'" end @@ -895,7 +895,7 @@ RSpec.describe "bundle install with explicit source paths" do end G - build_lib "bar", "1.0", :path => lib_path("foo/bar") + build_lib "bar", "1.0", path: lib_path("foo/bar") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -911,17 +911,17 @@ RSpec.describe "bundle install with explicit source paths" do describe "when there are both a gemspec and remote gems" do it "doesn't query rubygems for local gemspec name" do - build_lib "private_lib", "2.2", :path => lib_path("private_lib") + build_lib "private_lib", "2.2", path: lib_path("private_lib") gemfile lib_path("private_lib/Gemfile"), <<-G source "http://localgemserver.test" gemspec gem 'rack' G - bundle :install, :env => { "DEBUG" => "1" }, :artifice => "endpoint", :dir => lib_path("private_lib") + bundle :install, env: { "DEBUG" => "1" }, artifice: "endpoint", dir: lib_path("private_lib") expect(out).to match(%r{^HTTP GET http://localgemserver\.test/api/v1/dependencies\?gems=rack$}) expect(out).not_to match(/^HTTP GET.*private_lib/) - expect(the_bundle).to include_gems "private_lib 2.2", :dir => lib_path("private_lib") - expect(the_bundle).to include_gems "rack 1.0", :dir => lib_path("private_lib") + expect(the_bundle).to include_gems "private_lib 2.2", dir: lib_path("private_lib") + expect(the_bundle).to include_gems "rack 1.0", dir: lib_path("private_lib") end end @@ -942,7 +942,7 @@ RSpec.describe "bundle install with explicit source paths" do end bundle :install, - :requires => [lib_path("install_hooks.rb")] + requires: [lib_path("install_hooks.rb")] expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0") end @@ -962,7 +962,7 @@ RSpec.describe "bundle install with explicit source paths" do end bundle :install, - :requires => [lib_path("install_hooks.rb")] + requires: [lib_path("install_hooks.rb")] expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0") end @@ -981,7 +981,7 @@ RSpec.describe "bundle install with explicit source paths" do H end - bundle :install, :requires => [lib_path("install_hooks.rb")], :raise_on_error => false + bundle :install, requires: [lib_path("install_hooks.rb")], raise_on_error: false expect(err).to include("failed for foo-1.0") end diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index d4bbecfe04..d90dacdc02 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -305,23 +305,23 @@ RSpec.describe "bundle install across platforms" do aggregate_failures do lockfile bad_lockfile - bundle :install, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle :install, env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(lockfile).to eq good_lockfile lockfile bad_lockfile - bundle :update, :all => true, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle :update, all: true, env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(lockfile).to eq good_lockfile lockfile bad_lockfile - bundle "update ffi", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle "update ffi", env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(lockfile).to eq good_lockfile lockfile bad_lockfile - bundle "update empyrean", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle "update empyrean", env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(lockfile).to eq good_lockfile lockfile bad_lockfile - bundle :lock, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle :lock, env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(lockfile).to eq good_lockfile end end @@ -629,7 +629,7 @@ RSpec.describe "when a gem has no architecture" do gem "rcov" G - bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle :install, artifice: "windows", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(the_bundle).to include_gems "rcov 1.0.0" end end diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb index 39f09031b7..2b88e70928 100644 --- a/spec/bundler/install/gemfile/ruby_spec.rb +++ b/spec/bundler/install/gemfile/ruby_spec.rb @@ -112,7 +112,7 @@ RSpec.describe "ruby requirement" do end it "fails gracefully with malformed requirements" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" ruby ">= 0", "-.\\0" gem "rack" diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 7572fad90b..daee8a2744 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "refuses to install mismatched checksum because one gem has been tampered with", :bundler => "< 3" do + it "refuses to install mismatched checksum because one gem has been tampered with", bundler: "< 3" do lockfile <<~L GEM remote: https://gem.repo3/ @@ -45,7 +45,7 @@ RSpec.describe "bundle install with gems on multiple sources" do #{Bundler::VERSION} L - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(exitstatus).to eq(37) expect(err).to eq <<~E.strip @@ -71,16 +71,16 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config set --local disable_checksum_validation true" end - it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do - bundle :install, :artifice => "compact_index" + it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", bundler: "< 3" do + bundle :install, artifice: "compact_index" expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo1") - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") + expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", source: "remote1") end - it "does not use the full index unnecessarily", :bundler => "< 3" do - bundle :install, :artifice => "compact_index", :verbose => true + it "does not use the full index unnecessarily", bundler: "< 3" do + bundle :install, artifice: "compact_index", verbose: true expect(out).to include("https://gem.repo1/versions") expect(out).to include("https://gem.repo3/versions") @@ -88,8 +88,8 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(out).not_to include("https://gem.repo3/quick/Marshal.4.8/") end - it "fails", :bundler => "3" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + it "fails", bundler: "3" do + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) end @@ -108,15 +108,15 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do - bundle :install, :artifice => "compact_index" + it "warns about ambiguous gems, but installs anyway", bundler: "< 3" do + bundle :install, artifice: "compact_index" expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo1") - expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") + expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", source: "remote1") end - it "fails", :bundler => "3" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + it "fails", bundler: "3" do + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) end @@ -145,9 +145,9 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "works in standalone mode", :bundler => "< 3" do + it "works in standalone mode", bundler: "< 3" do gem_checksum = checksum_digest(gem_repo4, "foo", "1.0") - bundle "install --standalone", :artifice => "compact_index", :env => { "BUNDLER_SPEC_FOO_CHECKSUM" => gem_checksum } + bundle "install --standalone", artifice: "compact_index", env: { "BUNDLER_SPEC_FOO_CHECKSUM" => gem_checksum } end end @@ -177,20 +177,20 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the gems without any warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") expect(the_bundle).to include_gems("rack-obama 1.0.0") - expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote1") + expect(the_bundle).to include_gems("rack 1.0.0", source: "remote1") end it "can cache and deploy" do - bundle :cache, :artifice => "compact_index" + bundle :cache, artifice: "compact_index" expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist bundle "config set --local deployment true" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0") end @@ -210,7 +210,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo3" gem "rack-obama" # should come from repo3! gem "rack", :source => "https://gem.repo1" @@ -250,9 +250,9 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the same source without any warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") end end @@ -267,18 +267,18 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the same source without any warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") # In https://github.com/bundler/bundler/issues/3585 this failed # when there is already a lock file, and the gems are missing, so try again system_gems [] - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") end end end @@ -300,7 +300,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and not in any other sources" do before do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo2" source "https://gem.repo3" do gem "depends_on_rack" @@ -325,8 +325,8 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "fails when the two sources don't have the same checksum", :bundler => "< 3" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + it "fails when the two sources don't have the same checksum", bundler: "< 3" do + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to eq(<<~E.strip) [DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. @@ -347,9 +347,9 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(exitstatus).to eq(37) end - it "fails when the two sources agree, but the local gem calculates a different checksum", :bundler => "< 3" do + it "fails when the two sources agree, but the local gem calculates a different checksum", bundler: "< 3" do rack_checksum = "c0ffee11" * 8 - bundle :install, :artifice => "compact_index", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum }, :raise_on_error => false + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum }, raise_on_error: false expect(err).to eq(<<~E.strip) [DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. @@ -370,9 +370,9 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(exitstatus).to eq(37) end - it "installs from the other source and warns about ambiguous gems when the sources have the same checksum", :bundler => "< 3" do + it "installs from the other source and warns about ambiguous gems when the sources have the same checksum", bundler: "< 3" do gem_checksum = checksum_digest(gem_repo2, "rack", "1.0.0") - bundle :install, :artifice => "compact_index", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => gem_checksum, "DEBUG" => "1" } + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => gem_checksum, "DEBUG" => "1" } expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo2") @@ -410,9 +410,9 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(previous_lockfile) end - it "installs from the other source and warns about ambiguous gems when checksum validation is disabled", :bundler => "< 3" do + it "installs from the other source and warns about ambiguous gems when checksum validation is disabled", bundler: "< 3" do bundle "config set --local disable_checksum_validation true" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: https://gem.repo2") @@ -450,8 +450,8 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(previous_lockfile) end - it "fails", :bundler => "3" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + it "fails", bundler: "3" do + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) end @@ -475,8 +475,8 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the dependency from the pinned source without warning", :bundler => "< 3" do - bundle :install, :artifice => "compact_index" + it "installs the dependency from the pinned source without warning", bundler: "< 3" do + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") @@ -484,14 +484,14 @@ RSpec.describe "bundle install with gems on multiple sources" do # In https://github.com/rubygems/bundler/issues/3585 this failed # when there is already a lock file, and the gems are missing, so try again system_gems [] - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end - it "fails", :bundler => "3" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + it "fails", bundler: "3" do + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Each source after the first must include a block") expect(exitstatus).to eq(4) end @@ -519,12 +519,12 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "fails" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Could not find gem 'private_gem_1' in rubygems repository https://gem.repo2/ or installed locally.") end end - context "when an indirect dependency can't be found in the aggregate rubygems source", :bundler => "< 3" do + context "when an indirect dependency can't be found in the aggregate rubygems source", bundler: "< 3" do before do build_repo2 @@ -544,7 +544,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "fails" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to end_with <<~E.strip Could not find compatible versions @@ -588,11 +588,11 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the dependency from the top-level source without warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote2") - expect(the_bundle).to include_gems("unrelated_gem 1.0.0", :source => "remote3") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote2") + expect(the_bundle).to include_gems("unrelated_gem 1.0.0", source: "remote3") end end @@ -606,7 +606,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "does not find the dependency" do - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to end_with <<~E.strip Could not find compatible versions @@ -633,12 +633,12 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the dependency from the top-level source without warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") expect(run("require 'rack'; puts RACK")).to eq("1.0.0") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote2") - expect(the_bundle).to include_gems("unrelated_gem 1.0.0", :source => "remote3") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", source: "remote2") + expect(the_bundle).to include_gems("unrelated_gem 1.0.0", source: "remote3") end end end @@ -672,10 +672,10 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the dependency from the top-level source" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0") - expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote2") - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", :source => "remote3") + expect(the_bundle).to include_gems("rack 1.0.0", source: "remote2") + expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", source: "remote3") end end @@ -689,8 +689,8 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the dependency from the pinned source" do - bundle :install, :artifice => "compact_index" - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + bundle :install, artifice: "compact_index" + expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") end end @@ -708,8 +708,8 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the dependency from the pinned source without warning" do - bundle :install, :artifice => "compact_index" - expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + bundle :install, artifice: "compact_index" + expect(the_bundle).to include_gems("depends_on_depends_on_rack 1.0.1", "depends_on_rack 1.0.1", "rack 1.0.0", source: "remote3") end end end @@ -841,7 +841,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "does not install newer versions but updates the lockfile format when running bundle install in non frozen mode, and doesn't warn" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).to be_empty expect(the_bundle).to include_gems("activesupport 6.0.3.4") @@ -896,11 +896,11 @@ RSpec.describe "bundle install with gems on multiple sources" do L end - it "does not install newer versions or generate lockfile changes when running bundle install in frozen mode, and warns", :bundler => "< 3" do + it "does not install newer versions or generate lockfile changes when running bundle install in frozen mode, and warns", bundler: "< 3" do initial_lockfile = lockfile bundle "config set --local frozen true" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") @@ -914,11 +914,11 @@ RSpec.describe "bundle install with gems on multiple sources" do expect(lockfile).to eq(initial_lockfile) end - it "fails when running bundle install in frozen mode", :bundler => "3" do + it "fails when running bundle install in frozen mode", bundler: "3" do initial_lockfile = lockfile bundle "config set --local frozen true" - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") @@ -926,7 +926,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "splits sections and upgrades gems when running bundle update, and doesn't warn" do - bundle "update --all", :artifice => "compact_index" + bundle "update --all", artifice: "compact_index" expect(err).to be_empty expect(the_bundle).not_to include_gems("activesupport 6.0.3.4") @@ -987,7 +987,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "upgrades the lockfile format and upgrades the requested gem when running bundle update with an argument" do - bundle "update concurrent-ruby", :artifice => "compact_index" + bundle "update concurrent-ruby", artifice: "compact_index" expect(err).to be_empty expect(the_bundle).to include_gems("activesupport 6.0.3.4") @@ -1047,8 +1047,8 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when a top-level gem has an indirect dependency present in the default source, but with a different version from the one resolved" do before do - build_lib "activesupport", "7.0.0.alpha", :path => lib_path("rails/activesupport") - build_lib "rails", "7.0.0.alpha", :path => lib_path("rails") do |s| + build_lib "activesupport", "7.0.0.alpha", path: lib_path("rails/activesupport") + build_lib "rails", "7.0.0.alpha", path: lib_path("rails") do |s| s.add_dependency "activesupport", "= 7.0.0.alpha" end @@ -1070,11 +1070,11 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs all gems without warning" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(err).not_to include("Warning") expect(the_bundle).to include_gems("activesupport 7.0.0.alpha", "rails 7.0.0.alpha") - expect(the_bundle).to include_gems("activesupport 7.0.0.alpha", :source => "path@#{lib_path("rails/activesupport")}") - expect(the_bundle).to include_gems("rails 7.0.0.alpha", :source => "path@#{lib_path("rails")}") + expect(the_bundle).to include_gems("activesupport 7.0.0.alpha", source: "path@#{lib_path("rails/activesupport")}") + expect(the_bundle).to include_gems("rails 7.0.0.alpha", source: "path@#{lib_path("rails")}") end end @@ -1137,20 +1137,20 @@ RSpec.describe "bundle install with gems on multiple sources" do #{Bundler::VERSION} L - bundle "install --verbose", :artifice => "compact_index" + bundle "install --verbose", artifice: "compact_index" expect(err).not_to include("Warning") expect(the_bundle).to include_gems("handsoap 0.2.5.5", "nokogiri 1.11.1", "racca 1.5.2") - expect(the_bundle).to include_gems("handsoap 0.2.5.5", :source => "remote3") - expect(the_bundle).to include_gems("nokogiri 1.11.1", "racca 1.5.2", :source => "remote2") + expect(the_bundle).to include_gems("handsoap 0.2.5.5", source: "remote3") + expect(the_bundle).to include_gems("nokogiri 1.11.1", "racca 1.5.2", source: "remote2") expect(lockfile).to eq(expected_lockfile) # Even if the gems are already installed FileUtils.rm bundled_app_lock - bundle "install --verbose", :artifice => "compact_index" + bundle "install --verbose", artifice: "compact_index" expect(err).not_to include("Warning") expect(the_bundle).to include_gems("handsoap 0.2.5.5", "nokogiri 1.11.1", "racca 1.5.2") - expect(the_bundle).to include_gems("handsoap 0.2.5.5", :source => "remote3") - expect(the_bundle).to include_gems("nokogiri 1.11.1", "racca 1.5.2", :source => "remote2") + expect(the_bundle).to include_gems("handsoap 0.2.5.5", source: "remote3") + expect(the_bundle).to include_gems("nokogiri 1.11.1", "racca 1.5.2", source: "remote2") expect(lockfile).to eq(expected_lockfile) end end @@ -1161,7 +1161,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "not_in_repo1", "1.0.0" end - install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index", raise_on_error: false source "https://gem.repo3" gem "not_in_repo1", :source => "https://gem.repo1" G @@ -1174,7 +1174,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "with an existing lockfile" do before do - system_gems "rack-0.9.1", "rack-1.0.0", :path => default_bundle_path + system_gems "rack-0.9.1", "rack-1.0.0", path: default_bundle_path lockfile <<-L GEM @@ -1264,21 +1264,21 @@ RSpec.describe "bundle install with gems on multiple sources" do lockfile aggregate_gem_section_lockfile end - it "installs the existing lockfile but prints a warning when checksum validation is disabled", :bundler => "< 3" do + it "installs the existing lockfile but prints a warning when checksum validation is disabled", bundler: "< 3" do bundle "config set --local deployment true" bundle "config set --local disable_checksum_validation true" - bundle "install", :artifice => "compact_index" + bundle "install", artifice: "compact_index" expect(lockfile).to eq(aggregate_gem_section_lockfile) expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") - expect(the_bundle).to include_gems("rack 0.9.1", :source => "remote3") + expect(the_bundle).to include_gems("rack 0.9.1", source: "remote3") end - it "prints a checksum warning when the checksums from both sources do not match", :bundler => "< 3" do + it "prints a checksum warning when the checksums from both sources do not match", bundler: "< 3" do bundle "config set --local deployment true" - bundle "install", :artifice => "compact_index", :raise_on_error => false + bundle "install", artifice: "compact_index", raise_on_error: false api_checksum1 = checksum_digest(gem_repo1, "rack", "0.9.1") api_checksum3 = checksum_digest(gem_repo3, "rack", "0.9.1") @@ -1302,10 +1302,10 @@ RSpec.describe "bundle install with gems on multiple sources" do E end - it "refuses to install the existing lockfile and prints an error", :bundler => "3" do + it "refuses to install the existing lockfile and prints an error", bundler: "3" do bundle "config set --local deployment true" - bundle "install", :artifice => "compact_index", :raise_on_error => false + bundle "install", artifice: "compact_index", raise_on_error: false expect(lockfile).to eq(aggregate_gem_section_lockfile) expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") @@ -1325,7 +1325,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "does not unlock the non-path gem after install" do - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" bundle %(exec ruby -e 'puts "OK"') @@ -1338,7 +1338,7 @@ RSpec.describe "bundle install with gems on multiple sources" do before do system_gems "rack-0.9.1" - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" gem "rack" # should come from repo1! G @@ -1367,7 +1367,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G bundle "config set --local path ../gems/system" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" # And then we add some new versions... update_repo4 do @@ -1378,7 +1378,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "allows them to be unlocked separately" do # And install this gemfile, updating only foo. - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source 'https://gem.repo1' gem 'rack' gem 'foo', '~> 0.2', :source => 'https://gem.repo4' @@ -1402,7 +1402,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_git "git1" build_git "git2" - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" gem "rails" @@ -1418,7 +1418,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "does not re-resolve" do - bundle :install, :artifice => "compact_index", :verbose => true + bundle :install, artifice: "compact_index", verbose: true expect(out).to include("using resolution from the lockfile") expect(out).not_to include("re-resolving dependencies") end @@ -1427,7 +1427,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "when a gem is installed to system gems" do before do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" gem "rack" G @@ -1441,7 +1441,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end # When this gemfile is installed... - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" source "https://gem.repo4" do @@ -1463,14 +1463,14 @@ RSpec.describe "bundle install with gems on multiple sources" do G # But we should still be able to find rack 2.0.1.1.forked and install it - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" end end end describe "source changed to one containing a higher version of a dependency" do before do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" gem "rack" @@ -1484,11 +1484,11 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "bar" end - build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s| + build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s| s.add_dependency "bar", "=1.0.0" end - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo2" gem "rack" gemspec :path => "#{tmp.join("gemspec_test")}" @@ -1506,11 +1506,11 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "bar" end - build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s| + build_lib("gemspec_test", path: tmp.join("gemspec_test")) do |s| s.add_development_dependency "bar" end - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo1" source "https://gem.repo4" do @@ -1535,7 +1535,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "example", "1.0.2" end - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "https://gem.repo4" gem "example", :source => "https://gem.repo2" @@ -1544,9 +1544,9 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "info example" expect(out).to include("example (0.1.0)") - system_gems "example-1.0.2", :path => default_bundle_path, :gem_repo => gem_repo4 + system_gems "example-1.0.2", path: default_bundle_path, gem_repo: gem_repo4 - bundle "update example --verbose", :artifice => "compact_index" + bundle "update example --verbose", artifice: "compact_index" expect(out).not_to include("Using example 1.0.2") expect(out).to include("Using example 0.1.0") end @@ -1560,7 +1560,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end G - ruby <<~R, :raise_on_error => false + ruby <<~R, raise_on_error: false require 'bundler/setup' R @@ -1577,13 +1577,13 @@ RSpec.describe "bundle install with gems on multiple sources" do end G - bundle "install", :artifice => nil, :raise_on_error => false + bundle "install", artifice: nil, raise_on_error: false expect(last_command).to be_failure expect(err).to include("Could not reach host gem.repo4. Check your network connection and try again.") end - context "when an indirect dependency is available from multiple ambiguous sources", :bundler => "< 3" do + context "when an indirect dependency is available from multiple ambiguous sources", bundler: "< 3" do it "succeeds but warns, suggesting a source block" do build_repo4 do build_gem "depends_on_rack" do |s| @@ -1592,7 +1592,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "rack" end - install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index", raise_on_error: false source "#{file_uri_for(gem_repo1)}" source "https://gem.repo4" do @@ -1614,7 +1614,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - context "when an indirect dependency is available from multiple ambiguous sources", :bundler => "3" do + context "when an indirect dependency is available from multiple ambiguous sources", bundler: "3" do it "raises, suggesting a source block" do build_repo4 do build_gem "depends_on_rack" do |s| @@ -1623,7 +1623,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "rack" end - install_gemfile <<-G, :artifice => "compact_index", :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index", raise_on_error: false source "#{file_uri_for(gem_repo1)}" source "https://gem.repo4" do gem "depends_on_rack" @@ -1688,7 +1688,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "upgrades the lockfile correctly" do - bundle "lock --update", :artifice => "compact_index" + bundle "lock --update", artifice: "compact_index" checksums = checksums_section_when_existing do |c| c.checksum gem_repo2, "capybara", "2.5.0" @@ -1747,7 +1747,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "handles that fine" do - bundle "install", :artifice => "compact_index_extra", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install", artifice: "compact_index_extra", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } checksums = checksums_section_when_existing do |c| c.checksum gem_repo4, "pdf-writer", "1.1.8" @@ -1805,7 +1805,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "handles that fine" do - bundle "install", :artifice => "compact_index_extra", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install", artifice: "compact_index_extra", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } checksums = checksums_section_when_existing do |c| c.checksum gem_repo4, "pdf-writer", "1.1.8" @@ -1857,7 +1857,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "handles that fine" do - bundle "install --verbose", :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install --verbose", artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } checksums = checksums_section_when_existing do |c| c.checksum gem_repo4, "pdf-writer", "1.1.8" @@ -1893,7 +1893,7 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "example", "1.0.0" end - install_gemfile <<~G, :artifice => "compact_index" + install_gemfile <<~G, artifice: "compact_index" source "https://gem.repo2" source "https://gem.repo4" do @@ -1913,7 +1913,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "shows a proper error message and does not generate a corrupted lockfile" do expect do - bundle :install, :artifice => "compact_index", :raise_on_error => false, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle :install, artifice: "compact_index", raise_on_error: false, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } end.not_to change { lockfile } expect(err).to include("Could not find gem 'example' in rubygems repository https://gem.repo4/") diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb index 131426b443..8b37570793 100644 --- a/spec/bundler/install/gemfile/specific_platform_spec.rb +++ b/spec/bundler/install/gemfile/specific_platform_spec.rb @@ -26,9 +26,9 @@ RSpec.describe "bundle install with specific platforms" do system_gems "bundler-2.1.4" # Consistent location to install and look for gems - bundle "config set --local path vendor/bundle", :env => { "BUNDLER_VERSION" => "2.1.4" } + bundle "config set --local path vendor/bundle", env: { "BUNDLER_VERSION" => "2.1.4" } - install_gemfile(google_protobuf, :env => { "BUNDLER_VERSION" => "2.1.4" }) + install_gemfile(google_protobuf, env: { "BUNDLER_VERSION" => "2.1.4" }) # simulate lockfile created with old bundler, which only locks for ruby platform lockfile <<-L @@ -48,7 +48,7 @@ RSpec.describe "bundle install with specific platforms" do L # force strict usage of the lock file by setting frozen mode - bundle "config set --local frozen true", :env => { "BUNDLER_VERSION" => "2.1.4" } + bundle "config set --local frozen true", env: { "BUNDLER_VERSION" => "2.1.4" } # make sure the platform that got actually installed with the old bundler is used expect(the_bundle).to include_gem("google-protobuf 3.0.0.alpha.5.0.5.1 universal-darwin") @@ -62,7 +62,7 @@ RSpec.describe "bundle install with specific platforms" do system_gems "bundler-2.1.4" # Consistent location to install and look for gems - bundle "config set --local path vendor/bundle", :env => { "BUNDLER_VERSION" => "2.1.4" } + bundle "config set --local path vendor/bundle", env: { "BUNDLER_VERSION" => "2.1.4" } gemfile google_protobuf @@ -87,7 +87,7 @@ RSpec.describe "bundle install with specific platforms" do 2.1.4 L - bundle "update", :env => { "BUNDLER_VERSION" => Bundler::VERSION } + bundle "update", env: { "BUNDLER_VERSION" => Bundler::VERSION } checksums.checksum gem_repo2, "google-protobuf", "3.0.0.alpha.5.0.5.1" @@ -149,12 +149,12 @@ RSpec.describe "bundle install with specific platforms" do end it "still installs the generic RUBY variant if necessary" do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } expect(out).to include("Installing nokogiri 1.3.10") end it "still installs the generic RUBY variant if necessary, even in frozen mode" do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLE_FROZEN" => "true" } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLE_FROZEN" => "true" } expect(out).to include("Installing nokogiri 1.3.10") end end @@ -173,7 +173,7 @@ RSpec.describe "bundle install with specific platforms" do system_gems "bundler-2.1.4" # Consistent location to install and look for gems - bundle "config set --local path vendor/bundle", :env => { "BUNDLER_VERSION" => "2.1.4" } + bundle "config set --local path vendor/bundle", env: { "BUNDLER_VERSION" => "2.1.4" } gemfile <<-G source "https://localgemserver.test" @@ -197,10 +197,10 @@ RSpec.describe "bundle install with specific platforms" do 2.1.4 L - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_VERSION" => "2.1.4", "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_VERSION" => "2.1.4", "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Installing libv8 8.4.255.0 (universal-darwin)") - bundle "add mini_racer --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle "add mini_racer --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Using libv8 8.4.255.0 (universal-darwin)") end end @@ -234,7 +234,7 @@ RSpec.describe "bundle install with specific platforms" do #{Bundler::VERSION} L - bundle "install --verbose", :artifice => "compact_index_precompiled_before", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install --verbose", artifice: "compact_index_precompiled_before", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } expect(out).to include("Installing grpc 1.50.0 (universal-darwin)") end end @@ -403,7 +403,7 @@ RSpec.describe "bundle install with specific platforms" do ERROR simulate_platform "arm64-darwin-21" do - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false end expect(err).to include(error_message).once @@ -411,7 +411,7 @@ RSpec.describe "bundle install with specific platforms" do # Make sure it doesn't print error twice in verbose mode simulate_platform "arm64-darwin-21" do - bundle "lock --verbose", :raise_on_error => false + bundle "lock --verbose", raise_on_error: false end expect(err).to include(error_message).once @@ -445,7 +445,7 @@ RSpec.describe "bundle install with specific platforms" do ERROR simulate_platform "arm64-darwin-21" do - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false end expect(err).to include(error_message).once @@ -453,7 +453,7 @@ RSpec.describe "bundle install with specific platforms" do # Make sure it doesn't print error twice in verbose mode simulate_platform "arm64-darwin-21" do - bundle "lock --verbose", :raise_on_error => false + bundle "lock --verbose", raise_on_error: false end expect(err).to include(error_message).once @@ -470,7 +470,7 @@ RSpec.describe "bundle install with specific platforms" do gem "sorbet-static", "0.5.9889" G - bundle "lock", :raise_on_error => false, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } + bundle "lock", raise_on_error: false, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "true" } expect(err).to include <<~ERROR.rstrip Could not find gem 'sorbet-static (= 0.5.9889)' with platform 'ruby' in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. @@ -954,7 +954,7 @@ RSpec.describe "bundle install with specific platforms" do rack (3.0.7) PLATFORMS - #{lockfile_platforms("ruby", generic_local_platform, :defaults => [])} + #{lockfile_platforms("ruby", generic_local_platform, defaults: [])} DEPENDENCIES concurrent-ruby @@ -1165,7 +1165,7 @@ RSpec.describe "bundle install with specific platforms" do end end - it "does not fail when a platform variant is incompatible with the current ruby and another equivalent platform specific variant is part of the resolution", :rubygems => ">= 3.3.21" do + it "does not fail when a platform variant is incompatible with the current ruby and another equivalent platform specific variant is part of the resolution", rubygems: ">= 3.3.21" do build_repo4 do build_gem "nokogiri", "1.15.5" @@ -1195,7 +1195,7 @@ RSpec.describe "bundle install with specific platforms" do end simulate_platform "x86_64-linux" do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } # locks all compatible platforms, excluding Java and Windows expect(lockfile).to eq(<<~L) diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb index e643573454..158645d3eb 100644 --- a/spec/bundler/install/gemfile_spec.rb +++ b/spec/bundler/install/gemfile_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle install" do context "with duplicated gems" do it "will display a warning" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem 'rails', '~> 4.0.0' @@ -20,7 +20,7 @@ RSpec.describe "bundle install" do gem 'rack' G - bundle :install, :gemfile => bundled_app("NotGemfile") + bundle :install, gemfile: bundled_app("NotGemfile") # Specify BUNDLE_GEMFILE for `the_bundle` # to retrieve the proper Gemfile @@ -46,8 +46,8 @@ RSpec.describe "bundle install" do end it "uses the gemfile while in a subdirectory" do bundled_app("subdir").mkpath - bundle "install", :dir => bundled_app("subdir") - bundle "list", :dir => bundled_app("subdir") + bundle "install", dir: bundled_app("subdir") + bundle "list", dir: bundled_app("subdir") expect(out).to include("rack (1.0.0)") end @@ -61,7 +61,7 @@ RSpec.describe "bundle install" do gem "rack", :lib => "rack" G - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/You passed :lib as an option for gem 'rack', but it is invalid/) end end diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index ea21e66987..51d7af9ee2 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -21,7 +21,7 @@ RSpec.describe "compact index api" do gem " sinatra" G - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.") end @@ -31,7 +31,7 @@ RSpec.describe "compact index api" do gem "rails" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems( "rails 2.3.2", @@ -51,7 +51,7 @@ RSpec.describe "compact index api" do build_gem "Rack", "0.1" end - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem "rack", "1.0" gem "Rack", "0.1" @@ -69,7 +69,7 @@ RSpec.describe "compact index api" do gem "net-sftp" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems "net-sftp 1.1.1" end @@ -78,11 +78,11 @@ RSpec.describe "compact index api" do source "#{source_uri}" gem "rack" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" bundle "config set --local deployment true" bundle "config set --local path vendor/bundle" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -100,7 +100,7 @@ RSpec.describe "compact index api" do end G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems("rails 2.3.2") end @@ -116,10 +116,10 @@ RSpec.describe "compact index api" do gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" bundle "config set --local deployment true" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems("rails 2.3.2") end @@ -131,9 +131,9 @@ RSpec.describe "compact index api" do gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" G - bundle "install", :artifice => "compact_index" + bundle "install", artifice: "compact_index" bundle "config set --local deployment true" - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(the_bundle).to include_gems("foo 1.0") end @@ -144,7 +144,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :verbose => true, :artifice => "compact_index_forbidden" + bundle :install, verbose: true, artifice: "compact_index_forbidden" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -155,7 +155,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :verbose => true, :artifice => "compact_index_checksum_mismatch" + bundle :install, verbose: true, artifice: "compact_index_checksum_mismatch" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(out).to include("The checksum of /versions does not match the checksum provided by the server!") expect(out).to include('Calculated checksums {"sha-256"=>"8KfZiM/fszVkqhP/m5s9lvE6M9xKu4I1bU4Izddp5Ms="} did not match expected {"sha-256"=>"ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="}') @@ -176,7 +176,7 @@ RSpec.describe "compact index api" do versions.write("created_at") FileUtils.chmod("-r", versions) - bundle :install, :artifice => "compact_index", :raise_on_error => false + bundle :install, artifice: "compact_index", raise_on_error: false expect(err).to include( "There was an error while trying to read from `#{versions}`. It is likely that you need to grant read permissions for that path." @@ -191,7 +191,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -202,7 +202,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index_host_redirect" + bundle :install, artifice: "compact_index_host_redirect" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -225,7 +225,7 @@ RSpec.describe "compact index api" do H end - bundle :install, :artifice => "compact_index_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")] + bundle :install, artifice: "compact_index_host_redirect", requires: [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) expect(the_bundle).to include_gems "rack 1.0.0" end @@ -236,7 +236,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index_redirects", :raise_on_error => false + bundle :install, artifice: "compact_index_redirects", raise_on_error: false expect(err).to match(/Too many redirects/) end @@ -247,7 +247,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle "install --full-index", :artifice => "compact_index" + bundle "install --full-index", artifice: "compact_index" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -258,7 +258,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle "update --full-index", :artifice => "compact_index", :all => true + bundle "update --full-index", artifice: "compact_index", all: true expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -288,14 +288,14 @@ RSpec.describe "compact index api" do end end - system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0], :gem_repo => gem_repo2 + system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0], gem_repo: gem_repo2 bundle "config set --local path.system true" ENV["BUNDLER_SPEC_ALL_REQUESTS"] = <<~EOS.strip #{source_uri}/versions #{source_uri}/info/rack EOS - install_gemfile <<-G, :artifice => "compact_index", :verbose => true, :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + install_gemfile <<-G, artifice: "compact_index", verbose: true, env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } source "#{source_uri}" gem "rack" G @@ -303,7 +303,7 @@ RSpec.describe "compact index api" do expect(last_command.stdboth).not_to include "Double checking" end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do + it "fetches again when more dependencies are found in subsequent sources", bundler: "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -317,7 +317,7 @@ RSpec.describe "compact index api" do gem "back_deps" G - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" end @@ -329,7 +329,7 @@ RSpec.describe "compact index api" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "compact_index_extra", :verbose => true + install_gemfile <<-G, artifice: "compact_index_extra", verbose: true source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" @@ -344,7 +344,7 @@ RSpec.describe "compact index api" do source "#{source_uri}" gem "rack", "1.0.0" G - bundle :install, :artifice => "compact_index_extra_api" + bundle :install, artifice: "compact_index_extra_api" expect(the_bundle).to include_gems "rack 1.0.0" build_repo4 do @@ -358,11 +358,11 @@ RSpec.describe "compact index api" do source "#{source_uri}/extra" gem "rack", "1.2" G - bundle :install, :artifice => "compact_index_extra_api" + bundle :install, artifice: "compact_index_extra_api" expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do + it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -380,7 +380,7 @@ RSpec.describe "compact index api" do gem 'somegem', '1.0.0' G - bundle :install, :artifice => "compact_index_extra_api" + bundle :install, artifice: "compact_index_extra_api" expect(the_bundle).to include_gems "somegem 1.0.0" expect(the_bundle).to include_gems "activesupport 1.2.3" @@ -401,7 +401,7 @@ RSpec.describe "compact index api" do end G - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" expect(out).to include("Fetching gem metadata from http://localgemserver.test/") expect(out).to include("Fetching source index from http://localgemserver.test/extra") @@ -417,7 +417,7 @@ RSpec.describe "compact index api" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "compact_index_extra_missing" + install_gemfile <<-G, artifice: "compact_index_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" @@ -437,7 +437,7 @@ RSpec.describe "compact index api" do FileUtils.rm_rf Dir[gem_repo4("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "compact_index_extra_api_missing" + install_gemfile <<-G, artifice: "compact_index_extra_api_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" @@ -454,11 +454,11 @@ RSpec.describe "compact index api" do gem 'foo' G - bundle :install, :artifice => "compact_index_api_missing" + bundle :install, artifice: "compact_index_api_missing" expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using deployment mode", :bundler => "< 3" do + it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -472,9 +472,9 @@ RSpec.describe "compact index api" do gem "back_deps" G - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" bundle "config --set local deployment true" - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" expect(the_bundle).to include_gems "back_deps 1.0" end @@ -493,9 +493,9 @@ RSpec.describe "compact index api" do end G - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" bundle "config set --local deployment true" - bundle :install, :artifice => "compact_index_extra" + bundle :install, artifice: "compact_index_extra" expect(the_bundle).to include_gems "back_deps 1.0" end @@ -512,40 +512,40 @@ RSpec.describe "compact index api" do gem "bundler_dep" G - bundle :install, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle :install, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching gem metadata from #{source_uri}") end - it "installs the binstubs", :bundler => "< 3" do + it "installs the binstubs", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --binstubs", :artifice => "compact_index" + bundle "install --binstubs", artifice: "compact_index" gembin "rackup" expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do + it "installs the bins when using --path and uses autoclean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --path vendor/bundle", :artifice => "compact_index" + bundle "install --path vendor/bundle", artifice: "compact_index" expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do + it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --path vendor/bundle --no-clean", :artifice => "compact_index" + bundle "install --path vendor/bundle --no-clean", artifice: "compact_index" expect(vendored_gems("bin/rackup")).to exist end @@ -556,7 +556,7 @@ RSpec.describe "compact index api" do gem 'rack-obama' G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Post-install message from rack:") end @@ -566,7 +566,7 @@ RSpec.describe "compact index api" do gem 'rack_middleware' G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(out).to include("Post-install message from rack:") expect(out).to include("Rack's post install message") end @@ -588,7 +588,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index_basic_authentication" + bundle :install, artifice: "compact_index_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -599,19 +599,19 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :verbose => true, :artifice => "compact_index_basic_authentication" + bundle :install, verbose: true, artifice: "compact_index_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do + it "strips http basic auth creds when warning about ambiguous sources", bundler: "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" gem "rack" G - bundle :install, :artifice => "compact_index_basic_authentication" + bundle :install, artifice: "compact_index_basic_authentication" expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -623,7 +623,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index_creds_diff_host" + bundle :install, artifice: "compact_index_creds_diff_host" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -638,7 +638,7 @@ RSpec.describe "compact index api" do it "reads authentication details by host name from bundle config" do bundle "config set #{source_hostname} #{user}:#{password}" - bundle :install, :artifice => "compact_index_strict_basic_authentication" + bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -648,7 +648,7 @@ RSpec.describe "compact index api" do # The trailing slash is necessary here; Fetcher canonicalizes the URI. bundle "config set #{source_uri}/ #{user}:#{password}" - bundle :install, :artifice => "compact_index_strict_basic_authentication" + bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -656,7 +656,7 @@ RSpec.describe "compact index api" do it "should use the API" do bundle "config set #{source_hostname} #{user}:#{password}" - bundle :install, :artifice => "compact_index_strict_basic_authentication" + bundle :install, artifice: "compact_index_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -669,26 +669,26 @@ RSpec.describe "compact index api" do bundle "config set #{source_hostname} otheruser:wrong" - bundle :install, :artifice => "compact_index_strict_basic_authentication" + bundle :install, artifice: "compact_index_strict_basic_authentication" expect(the_bundle).to include_gems "rack 1.0.0" end it "shows instructions if auth is not provided for the source" do - bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false + bundle :install, artifice: "compact_index_strict_basic_authentication", raise_on_error: false expect(err).to include("bundle config set --global #{source_hostname} username:password") end it "fails if authentication has already been provided, but failed" do bundle "config set #{source_hostname} #{user}:wrong" - bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false + bundle :install, artifice: "compact_index_strict_basic_authentication", raise_on_error: false expect(err).to include("Bad username or password") end it "does not fallback to old dependency API if bad authentication is provided" do bundle "config set #{source_hostname} #{user}:wrong" - bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false, :verbose => true + bundle :install, artifice: "compact_index_strict_basic_authentication", raise_on_error: false, verbose: true expect(err).to include("Bad username or password") expect(out).to include("HTTP 401 Unauthorized http://[email protected]/versions") expect(out).not_to include("HTTP 401 Unauthorized http://[email protected]/api/v1/dependencies") @@ -704,7 +704,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :artifice => "compact_index_basic_authentication" + bundle :install, artifice: "compact_index_basic_authentication" expect(the_bundle).to include_gems "rack 1.0.0" end end @@ -729,7 +729,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, :raise_on_error => false + bundle :install, env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false expect(err).to include("OpenSSL") end end @@ -749,7 +749,7 @@ RSpec.describe "compact index api" do gem "rack" G - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/could not verify the SSL certificate/i) end end @@ -757,7 +757,7 @@ RSpec.describe "compact index api" do context ".gemrc with sources is present" do it "uses other sources declared in the Gemfile" do File.open(home(".gemrc"), "w") do |file| - file.puts({ :sources => ["https://rubygems.org"] }.to_yaml) + file.puts({ sources: ["https://rubygems.org"] }.to_yaml) end begin @@ -766,7 +766,7 @@ RSpec.describe "compact index api" do gem 'rack' G - bundle :install, :artifice => "compact_index_forbidden" + bundle :install, artifice: "compact_index_forbidden" ensure home(".gemrc").rmtree end @@ -786,7 +786,7 @@ RSpec.describe "compact index api" do G # Initial install creates the cached versions file and etag file - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expect(versions_etag.file?).to eq(true) previous_content = versions_etag.binread @@ -798,7 +798,7 @@ RSpec.describe "compact index api" do G # Second install should match etag - bundle :install, :artifice => "compact_index_etag_match" + bundle :install, artifice: "compact_index_etag_match" expect(versions_etag.binread).to eq(previous_content) expect(the_bundle).to include_gems "rack 1.0.0" @@ -811,7 +811,7 @@ RSpec.describe "compact index api" do G # Initial install creates the cached versions file and etag file - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" gemfile <<-G source "#{source_uri}" @@ -826,7 +826,7 @@ RSpec.describe "compact index api" do # in this test, the range is ignored so this gets overwritten, allowing install. versions.write "ruining this file" - bundle :install, :artifice => "compact_index_range_ignored" + bundle :install, artifice: "compact_index_range_ignored" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -837,7 +837,7 @@ RSpec.describe "compact index api" do end # Initial install creates the cached versions file - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '0.9.1' G @@ -846,7 +846,7 @@ RSpec.describe "compact index api" do build_gem "rack", "1.0.0" end - install_gemfile <<-G, :artifice => "compact_index_partial_update", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index_partial_update", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '1.0.0' G @@ -868,7 +868,7 @@ RSpec.describe "compact index api" do versions.dirname.mkpath versions.write("created_at") - bundle :install, :artifice => "compact_index_concurrent_download" + bundle :install, artifice: "compact_index_concurrent_download" expect(versions.read).to start_with("created_at") expect(the_bundle).to include_gems "rack 1.0.0" @@ -879,7 +879,7 @@ RSpec.describe "compact index api" do build_gem "rack", "0.9.1" end - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '0.9.1' G @@ -888,7 +888,7 @@ RSpec.describe "compact index api" do build_gem "rack", "1.0.0" end - install_gemfile <<-G, :artifice => "compact_index_partial_update_bad_digest", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index_partial_update_bad_digest", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '1.0.0' G @@ -901,7 +901,7 @@ RSpec.describe "compact index api" do build_gem "rack", "0.9.1" end - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '0.9.1' G @@ -910,7 +910,7 @@ RSpec.describe "compact index api" do build_gem "rack", "1.0.0" end - install_gemfile <<-G, :artifice => "compact_index_partial_update_no_digest_not_incremental", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index_partial_update_no_digest_not_incremental", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } source "#{source_uri}" gem 'rack', '1.0.0' G @@ -927,7 +927,7 @@ RSpec.describe "compact index api" do rake_info_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "info", "rack") - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" expected_rack_info_content = File.read(rake_info_path) @@ -942,7 +942,7 @@ RSpec.describe "compact index api" do # The cache files now being longer means the requested range is going to be not satisfiable # Bundler must end up requesting the whole file to fix things up. - bundle :install, :artifice => "compact_index_range_not_satisfiable" + bundle :install, artifice: "compact_index_range_not_satisfiable" resulting_rack_info_content = File.read(rake_info_path) @@ -950,7 +950,7 @@ RSpec.describe "compact index api" do end it "fails gracefully when the source URI has an invalid scheme" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "htps://rubygems.org" gem "rack" G @@ -981,7 +981,7 @@ RSpec.describe "compact index api" do it "handles checksums from the server in base64" do api_checksum = checksum_digest(gem_repo1, "rack", "1.0.0") rack_checksum = [[api_checksum].pack("H*")].pack("m0") - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => rack_checksum } source "#{source_uri}" gem "rack" G @@ -991,7 +991,7 @@ RSpec.describe "compact index api" do end it "raises when the checksum does not match" do - install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum", raise_on_error: false source "#{source_uri}" gem "rack" G @@ -1020,7 +1020,7 @@ RSpec.describe "compact index api" do end it "raises when the checksum is the wrong length" do - install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, :verbose => true, :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum", env: { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, verbose: true, raise_on_error: false source "#{source_uri}" gem "rack" G @@ -1030,7 +1030,7 @@ RSpec.describe "compact index api" do it "does not raise when disable_checksum_validation is set" do bundle "config set disable_checksum_validation true" - install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum" + install_gemfile <<-G, artifice: "compact_index_wrong_gem_checksum" source "#{source_uri}" gem "rack" G @@ -1038,7 +1038,7 @@ RSpec.describe "compact index api" do end it "works when cache dir is world-writable" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" File.umask(0000) source "#{source_uri}" gem "rack" @@ -1046,7 +1046,7 @@ RSpec.describe "compact index api" do end it "doesn't explode when the API dependencies are wrong" do - install_gemfile <<-G, :artifice => "compact_index_wrong_dependencies", :env => { "DEBUG" => "true" }, :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index_wrong_dependencies", env: { "DEBUG" => "true" }, raise_on_error: false source "#{source_uri}" gem "rails" G @@ -1063,7 +1063,7 @@ Running `bundle update rails` should fix the problem. end it "does not duplicate specs in the lockfile when updating and a dependency is not installed" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "#{file_uri_for(gem_repo1)}" source "#{source_uri}" do gem "rails" @@ -1071,7 +1071,7 @@ Running `bundle update rails` should fix the problem. end G gem_command "uninstall activemerchant" - bundle "update rails", :artifice => "compact_index" + bundle "update rails", artifice: "compact_index" count = lockfile.match?("CHECKSUMS") ? 2 : 1 # Once in the specs, and once in CHECKSUMS expect(lockfile.scan(/activemerchant \(/).size).to eq(count) end diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index c379e5ea8f..10a3ed4c70 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -21,7 +21,7 @@ RSpec.describe "gemcutter's dependency API" do gem " sinatra" G - bundle :install, :artifice => "endpoint", :raise_on_error => false + bundle :install, artifice: "endpoint", raise_on_error: false expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.") end @@ -31,7 +31,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rails" G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}/...") expect(the_bundle).to include_gems( "rails 2.3.2", @@ -49,7 +49,7 @@ RSpec.describe "gemcutter's dependency API" do gem "net-sftp" G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(the_bundle).to include_gems "net-sftp 1.1.1" end @@ -58,11 +58,11 @@ RSpec.describe "gemcutter's dependency API" do source "#{source_uri}" gem "rack" G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" bundle "config set --local deployment true" bundle "config set --local path vendor/bundle" - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -80,7 +80,7 @@ RSpec.describe "gemcutter's dependency API" do end G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(the_bundle).to include_gems("rails 2.3.2") end @@ -96,10 +96,10 @@ RSpec.describe "gemcutter's dependency API" do gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" bundle "config set --local deployment true" - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(the_bundle).to include_gems("rails 2.3.2") end @@ -111,9 +111,9 @@ RSpec.describe "gemcutter's dependency API" do gem 'foo', :git => "#{file_uri_for(lib_path("foo-1.0"))}" G - bundle "install", :artifice => "endpoint" + bundle "install", artifice: "endpoint" bundle "config set --local deployment true" - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(the_bundle).to include_gems("foo 1.0") end @@ -134,7 +134,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rcov" G - bundle :install, :artifice => "windows", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle :install, artifice: "windows", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rcov 1.0.0" end @@ -150,7 +150,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" gem "rails" G - bundle :install, :artifice => "endpoint_fallback" + bundle :install, artifice: "endpoint_fallback" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems( @@ -171,7 +171,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :verbose => true, :artifice => "endpoint_marshal_fail" + bundle :install, verbose: true, artifice: "endpoint_marshal_fail" expect(out).to include("could not fetch from the dependency API, trying the full index") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -182,7 +182,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :verbose => true, :artifice => "endpoint_api_forbidden" + bundle :install, verbose: true, artifice: "endpoint_api_forbidden" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -193,7 +193,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_host_redirect" + bundle :install, artifice: "endpoint_host_redirect" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -216,7 +216,7 @@ RSpec.describe "gemcutter's dependency API" do H end - bundle :install, :artifice => "endpoint_host_redirect", :requires => [lib_path("disable_net_http_persistent.rb")] + bundle :install, artifice: "endpoint_host_redirect", requires: [lib_path("disable_net_http_persistent.rb")] expect(out).to_not match(/Too many redirects/) expect(the_bundle).to include_gems "rack 1.0.0" end @@ -227,7 +227,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_redirect", :raise_on_error => false + bundle :install, artifice: "endpoint_redirect", raise_on_error: false expect(err).to match(/Too many redirects/) end @@ -238,7 +238,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle "install --full-index", :artifice => "endpoint" + bundle "install --full-index", artifice: "endpoint" expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -249,13 +249,13 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle "update --full-index", :artifice => "endpoint", :all => true + bundle "update --full-index", artifice: "endpoint", all: true expect(out).to include("Fetching source index from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end end - it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 3" do + it "fetches again when more dependencies are found in subsequent sources", bundler: "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -269,7 +269,7 @@ RSpec.describe "gemcutter's dependency API" do gem "back_deps" G - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" end @@ -288,7 +288,7 @@ RSpec.describe "gemcutter's dependency API" do end G - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" end @@ -297,7 +297,7 @@ RSpec.describe "gemcutter's dependency API" do source "#{source_uri}" gem "rack", "1.0.0" G - bundle :install, :artifice => "endpoint_extra_api" + bundle :install, artifice: "endpoint_extra_api" build_repo4 do build_gem "rack", "1.2" do |s| @@ -310,11 +310,11 @@ RSpec.describe "gemcutter's dependency API" do source "#{source_uri}/extra" gem "rack", "1.2" G - bundle :install, :artifice => "endpoint_extra_api" + bundle :install, artifice: "endpoint_extra_api" expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 3" do + it "considers all possible versions of dependencies from all api gem sources", bundler: "< 3" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -332,7 +332,7 @@ RSpec.describe "gemcutter's dependency API" do gem 'somegem', '1.0.0' G - bundle :install, :artifice => "endpoint_extra_api" + bundle :install, artifice: "endpoint_extra_api" expect(the_bundle).to include_gems "somegem 1.0.0" expect(the_bundle).to include_gems "activesupport 1.2.3" @@ -353,13 +353,13 @@ RSpec.describe "gemcutter's dependency API" do end G - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" expect(out).to include("Fetching gem metadata from http://localgemserver.test/.") expect(out).to include("Fetching source index from http://localgemserver.test/extra") end - it "does not fetch every spec when doing back deps", :bundler => "< 3" do + it "does not fetch every spec when doing back deps", bundler: "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -369,7 +369,7 @@ RSpec.describe "gemcutter's dependency API" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "endpoint_extra_missing" + install_gemfile <<-G, artifice: "endpoint_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" gem "back_deps" @@ -388,7 +388,7 @@ RSpec.describe "gemcutter's dependency API" do FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] end - install_gemfile <<-G, :artifice => "endpoint_extra_missing" + install_gemfile <<-G, artifice: "endpoint_extra_missing" source "#{source_uri}" source "#{source_uri}/extra" do gem "back_deps" @@ -398,7 +398,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "back_deps 1.0" end - it "fetches again when more dependencies are found in subsequent sources using deployment mode", :bundler => "< 3" do + it "fetches again when more dependencies are found in subsequent sources using deployment mode", bundler: "< 3" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -412,9 +412,9 @@ RSpec.describe "gemcutter's dependency API" do gem "back_deps" G - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" bundle "config set --local deployment true" - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" expect(the_bundle).to include_gems "back_deps 1.0" end @@ -433,9 +433,9 @@ RSpec.describe "gemcutter's dependency API" do end G - bundle :install, :artifice => "endpoint_extra" + bundle :install, artifice: "endpoint_extra" bundle "config set --local deployment true" - bundle "install", :artifice => "endpoint_extra" + bundle "install", artifice: "endpoint_extra" expect(the_bundle).to include_gems "back_deps 1.0" end @@ -445,7 +445,7 @@ RSpec.describe "gemcutter's dependency API" do build_gem "foo", "2.0" end - install_gemfile <<-G, :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :verbose => true + install_gemfile <<-G, artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, verbose: true source "#{source_uri}" gem "foo" @@ -468,40 +468,40 @@ RSpec.describe "gemcutter's dependency API" do gem "bundler_dep" G - bundle :install, :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle :install, artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } expect(out).to include("Fetching gem metadata from #{source_uri}") end - it "installs the binstubs", :bundler => "< 3" do + it "installs the binstubs", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --binstubs", :artifice => "endpoint" + bundle "install --binstubs", artifice: "endpoint" gembin "rackup" expect(out).to eq("1.0.0") end - it "installs the bins when using --path and uses autoclean", :bundler => "< 3" do + it "installs the bins when using --path and uses autoclean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --path vendor/bundle", :artifice => "endpoint" + bundle "install --path vendor/bundle", artifice: "endpoint" expect(vendored_gems("bin/rackup")).to exist end - it "installs the bins when using --path and uses bundle clean", :bundler => "< 3" do + it "installs the bins when using --path and uses bundle clean", bundler: "< 3" do gemfile <<-G source "#{source_uri}" gem "rack" G - bundle "install --path vendor/bundle --no-clean", :artifice => "endpoint" + bundle "install --path vendor/bundle --no-clean", artifice: "endpoint" expect(vendored_gems("bin/rackup")).to exist end @@ -512,7 +512,7 @@ RSpec.describe "gemcutter's dependency API" do gem 'rack-obama' G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(out).to include("Post-install message from rack:") end @@ -522,7 +522,7 @@ RSpec.describe "gemcutter's dependency API" do gem 'rack_middleware' G - bundle :install, :artifice => "endpoint" + bundle :install, artifice: "endpoint" expect(out).to include("Post-install message from rack:") expect(out).to include("Rack's post install message") end @@ -544,7 +544,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_basic_authentication" + bundle :install, artifice: "endpoint_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -555,7 +555,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :verbose => true, :artifice => "endpoint_basic_authentication" + bundle :install, verbose: true, artifice: "endpoint_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -566,7 +566,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_marshal_fail_basic_authentication" + bundle :install, artifice: "endpoint_marshal_fail_basic_authentication" expect(out).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -577,18 +577,18 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_500", :raise_on_error => false + bundle :install, artifice: "endpoint_500", raise_on_error: false expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 3" do + it "strips http basic auth creds when warning about ambiguous sources", bundler: "< 3" do gemfile <<-G source "#{basic_auth_source_uri}" source "#{file_uri_for(gem_repo1)}" gem "rack" G - bundle :install, :artifice => "endpoint_basic_authentication" + bundle :install, artifice: "endpoint_basic_authentication" expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).not_to include("#{user}:#{password}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -600,7 +600,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_creds_diff_host" + bundle :install, artifice: "endpoint_creds_diff_host" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -613,7 +613,7 @@ RSpec.describe "gemcutter's dependency API" do end it "reads authentication details from a valid ENV variable" do - bundle :install, :artifice => "endpoint_strict_basic_authentication", :env => { "BUNDLE_LOCAL___GEMSERVER__TEST" => "#{user}:#{password}" } + bundle :install, artifice: "endpoint_strict_basic_authentication", env: { "BUNDLE_LOCAL___GEMSERVER__TEST" => "#{user}:#{password}" } expect(out).to include("Fetching gem metadata from http://local-gemserver.test") expect(the_bundle).to include_gems "rack 1.0.0" @@ -631,7 +631,7 @@ RSpec.describe "gemcutter's dependency API" do it "reads authentication details by host name from bundle config" do bundle "config set #{source_hostname} #{user}:#{password}" - bundle :install, :artifice => "endpoint_strict_basic_authentication" + bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -641,7 +641,7 @@ RSpec.describe "gemcutter's dependency API" do # The trailing slash is necessary here; Fetcher canonicalizes the URI. bundle "config set #{source_uri}/ #{user}:#{password}" - bundle :install, :artifice => "endpoint_strict_basic_authentication" + bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" @@ -649,7 +649,7 @@ RSpec.describe "gemcutter's dependency API" do it "should use the API" do bundle "config set #{source_hostname} #{user}:#{password}" - bundle :install, :artifice => "endpoint_strict_basic_authentication" + bundle :install, artifice: "endpoint_strict_basic_authentication" expect(out).to include("Fetching gem metadata from #{source_uri}") expect(the_bundle).to include_gems "rack 1.0.0" end @@ -662,19 +662,19 @@ RSpec.describe "gemcutter's dependency API" do bundle "config set #{source_hostname} otheruser:wrong" - bundle :install, :artifice => "endpoint_strict_basic_authentication" + bundle :install, artifice: "endpoint_strict_basic_authentication" expect(the_bundle).to include_gems "rack 1.0.0" end it "shows instructions if auth is not provided for the source" do - bundle :install, :artifice => "endpoint_strict_basic_authentication", :raise_on_error => false + bundle :install, artifice: "endpoint_strict_basic_authentication", raise_on_error: false expect(err).to include("bundle config set --global #{source_hostname} username:password") end it "fails if authentication has already been provided, but failed" do bundle "config set #{source_hostname} #{user}:wrong" - bundle :install, :artifice => "endpoint_strict_basic_authentication", :raise_on_error => false + bundle :install, artifice: "endpoint_strict_basic_authentication", raise_on_error: false expect(err).to include("Bad username or password") end end @@ -688,7 +688,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :artifice => "endpoint_basic_authentication" + bundle :install, artifice: "endpoint_basic_authentication" expect(the_bundle).to include_gems "rack 1.0.0" end end @@ -713,7 +713,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, :raise_on_error => false + bundle :install, env: { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, raise_on_error: false expect(err).to include("OpenSSL") end end @@ -733,7 +733,7 @@ RSpec.describe "gemcutter's dependency API" do gem "rack" G - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to match(/could not verify the SSL certificate/i) end end @@ -741,7 +741,7 @@ RSpec.describe "gemcutter's dependency API" do context ".gemrc with sources is present" do it "uses other sources declared in the Gemfile" do File.open(home(".gemrc"), "w") do |file| - file.puts({ :sources => ["https://rubygems.org"] }.to_yaml) + file.puts({ sources: ["https://rubygems.org"] }.to_yaml) end begin @@ -750,7 +750,7 @@ RSpec.describe "gemcutter's dependency API" do gem 'rack' G - bundle "install", :artifice => "endpoint_marshal_fail" + bundle "install", artifice: "endpoint_marshal_fail" ensure home(".gemrc").rmtree end diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb index 01222cbbc4..5e0c88fc95 100644 --- a/spec/bundler/install/gems/flex_spec.rb +++ b/spec/bundler/install/gems/flex_spec.rb @@ -183,8 +183,8 @@ RSpec.describe "bundle flex_install" do end it "does not install gems whose dependencies are not met" do - bundle :install, :raise_on_error => false - ruby <<-RUBY, :raise_on_error => false + bundle :install, raise_on_error: false + ruby <<-RUBY, raise_on_error: false require 'bundler/setup' RUBY expect(err).to match(/could not find gem 'rack-obama/i) @@ -203,7 +203,7 @@ RSpec.describe "bundle flex_install" do version solving has failed. E - bundle :install, :retry => 0, :raise_on_error => false + bundle :install, retry: 0, raise_on_error: false expect(err).to end_with(nice_error) end @@ -216,7 +216,7 @@ RSpec.describe "bundle flex_install" do rack-obama (= 2.0) E - bundle "update rack_middleware", :retry => 0, :raise_on_error => false + bundle "update rack_middleware", retry: 0, raise_on_error: false expect(err).not_to end_with(bad_error) end end @@ -245,7 +245,7 @@ RSpec.describe "bundle flex_install" do end it "discards the conflicting lockfile information and resolves properly" do - bundle :update, :raise_on_error => false, :all => true + bundle :update, raise_on_error: false, all: true expect(err).to be_empty end end diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb index 5c18d2cc51..51335272a9 100644 --- a/spec/bundler/install/gems/native_extensions_spec.rb +++ b/spec/bundler/install/gems/native_extensions_spec.rb @@ -93,7 +93,7 @@ RSpec.describe "installing a gem with native extensions" do it "installs correctly from git when multiple gems with extensions share one repository" do build_repo2 do ["one", "two"].each do |n| - build_lib "c_extension_#{n}", "1.0", :path => lib_path("gems/c_extension_#{n}") do |s| + build_lib "c_extension_#{n}", "1.0", path: lib_path("gems/c_extension_#{n}") do |s| s.extensions = ["ext/extconf.rb"] s.write "ext/extconf.rb", <<-E require "mkmf" @@ -122,7 +122,7 @@ RSpec.describe "installing a gem with native extensions" do C end end - build_git "gems", :path => lib_path("gems"), :gemspec => false + build_git "gems", path: lib_path("gems"), gemspec: false end bundle "config set build.c_extension_one --with-c_extension_one=one" diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb index 8c9ec61ed0..b54674898d 100644 --- a/spec/bundler/install/gems/resolving_spec.rb +++ b/spec/bundler/install/gems/resolving_spec.rb @@ -131,7 +131,7 @@ RSpec.describe "bundle install with install-time dependencies" do end it "installs plugins depended on by other plugins" do - install_gemfile <<-G, :env => { "DEBUG" => "1" } + install_gemfile <<-G, env: { "DEBUG" => "1" } source "#{file_uri_for(gem_repo2)}" gem "net_a" G @@ -140,7 +140,7 @@ RSpec.describe "bundle install with install-time dependencies" do end it "installs multiple levels of dependencies" do - install_gemfile <<-G, :env => { "DEBUG" => "1" } + install_gemfile <<-G, env: { "DEBUG" => "1" } source "#{file_uri_for(gem_repo2)}" gem "net_c" gem "net_e" @@ -157,7 +157,7 @@ RSpec.describe "bundle install with install-time dependencies" do gem "net_e" G - bundle :install, :env => { "BUNDLER_DEBUG_RESOLVER" => "1", "DEBUG" => "1" } + bundle :install, env: { "BUNDLER_DEBUG_RESOLVER" => "1", "DEBUG" => "1" } expect(out).to include("Resolving dependencies...") end @@ -171,7 +171,7 @@ RSpec.describe "bundle install with install-time dependencies" do gem "net_e" G - bundle :install, :env => { "DEBUG_RESOLVER" => "1", "DEBUG" => "1" } + bundle :install, env: { "DEBUG_RESOLVER" => "1", "DEBUG" => "1" } expect(out).to include("Resolving dependencies...") end @@ -185,7 +185,7 @@ RSpec.describe "bundle install with install-time dependencies" do gem "net_e" G - bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1", "DEBUG" => "1" } + bundle :install, env: { "DEBUG_RESOLVER_TREE" => "1", "DEBUG" => "1" } expect(out).to include(" net_b"). and include("Resolving dependencies..."). @@ -208,7 +208,7 @@ RSpec.describe "bundle install with install-time dependencies" do end end - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" gem 'rack' @@ -229,7 +229,7 @@ RSpec.describe "bundle install with install-time dependencies" do end end - install_gemfile <<-G, :artifice => "endpoint", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + install_gemfile <<-G, artifice: "endpoint", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" gem 'rack' @@ -278,7 +278,7 @@ RSpec.describe "bundle install with install-time dependencies" do end it "automatically updates lockfile to use the older version" do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } checksums = checksums_section_when_existing do |c| c.checksum gem_repo2, "parallel_tests", "3.7.0" @@ -303,7 +303,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "gives a meaningful error if we're in frozen mode" do expect do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s, "BUNDLE_FROZEN" => "true" }, :raise_on_error => false + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s, "BUNDLE_FROZEN" => "true" }, raise_on_error: false end.not_to change { lockfile } expect(err).to include("parallel_tests-3.8.0 requires ruby version >= #{next_ruby_minor}") @@ -365,7 +365,7 @@ RSpec.describe "bundle install with install-time dependencies" do end it "automatically updates lockfile to use the older compatible versions" do - bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } + bundle "install --verbose", artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } checksums = checksums_section_when_existing do |c| c.checksum gem_repo2, "rubocop", "1.28.2" @@ -430,7 +430,7 @@ RSpec.describe "bundle install with install-time dependencies" do it "raises a proper error" do simulate_platform "aarch64-linux" do - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false end nice_error = <<~E.strip @@ -484,7 +484,7 @@ RSpec.describe "bundle install with install-time dependencies" do gem "sorbet-static" G - bundle "lock", :raise_on_error => false + bundle "lock", raise_on_error: false end end @@ -506,13 +506,13 @@ RSpec.describe "bundle install with install-time dependencies" do end end - build_lib("foo", :path => bundled_app) do |s| + build_lib("foo", path: bundled_app) do |s| s.required_ruby_version = ">= #{Gem.ruby_version}" s.add_dependency "requires-old-ruby" end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo4)}" gemspec G @@ -538,7 +538,7 @@ RSpec.describe "bundle install with install-time dependencies" do build_gem "foo1", "1.0" end - install_gemfile <<-G, :artifice => "compact_index_rate_limited", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index_rate_limited", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" gem 'rack' @@ -562,7 +562,7 @@ RSpec.describe "bundle install with install-time dependencies" do end simulate_platform x86_mingw32 do - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } ruby "#{Gem.ruby_version}" source "http://localgemserver.test/" gem 'rack' @@ -588,7 +588,7 @@ RSpec.describe "bundle install with install-time dependencies" do let(:error_message_requirement) { "= #{Gem.ruby_version}" } it "raises a proper error that mentions the current Ruby version during resolution" do - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, raise_on_error: false source "http://localgemserver.test/" gem 'require_ruby' G @@ -609,7 +609,7 @@ RSpec.describe "bundle install with install-time dependencies" do shared_examples_for "ruby version conflicts" do it "raises an error during resolution" do - install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, raise_on_error: false source "http://localgemserver.test/" ruby #{ruby_requirement} gem 'require_ruby' @@ -655,7 +655,7 @@ RSpec.describe "bundle install with install-time dependencies" do end end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem 'require_rubygems' G diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index 4929c45337..240c3ad6a9 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -97,7 +97,7 @@ RSpec.shared_examples "bundle install --standalone" do testrb << "\nrequire \"#{k}\"" testrb << "\nputs #{k.upcase}" end - ruby testrb, :dir => "#{bundled_app}2" + ruby testrb, dir: "#{bundled_app}2" expect(out).to eq(expected_gems.values.join("\n")) end @@ -126,7 +126,7 @@ RSpec.shared_examples "bundle install --standalone" do gem "rails" G bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :dir => cwd + bundle :install, standalone: true, dir: cwd end let(:expected_gems) do @@ -141,20 +141,20 @@ RSpec.shared_examples "bundle install --standalone" do describe "with default gems and a lockfile", :ruby_repo do before do - 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 + 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 realworld_system_gems "tsort --version 0.1.0" necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.1"] necessary_system_gems += ["shellwords --version 0.1.0", "base64 --version 0.1.0", "resolv --version 0.2.1"] if Gem.rubygems_version < Gem::Version.new("3.3.a") necessary_system_gems += ["yaml --version 0.1.1"] if Gem.rubygems_version < Gem::Version.new("3.4.a") - realworld_system_gems(*necessary_system_gems, :path => scoped_gem_path(bundled_app("bundle"))) + realworld_system_gems(*necessary_system_gems, path: scoped_gem_path(bundled_app("bundle"))) - build_gem "foo", "1.0.0", :to_system => true, :default => true do |s| + build_gem "foo", "1.0.0", to_system: true, default: true do |s| s.add_dependency "bar" end - build_gem "bar", "1.0.0", :to_system => true, :default => true + build_gem "bar", "1.0.0", to_system: true, default: true build_repo4 do build_gem "foo", "1.0.0" do |s| @@ -169,12 +169,12 @@ RSpec.shared_examples "bundle install --standalone" do gem "foo" G - bundle "lock", :dir => cwd, :artifice => "compact_index" + bundle "lock", dir: cwd, artifice: "compact_index" end it "works and points to the vendored copies, not to the default copies", :realworld do bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :dir => cwd, :artifice => "compact_index", :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } + bundle :install, standalone: true, dir: cwd, artifice: "compact_index", env: { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } load_path_lines = bundled_app("bundle/bundler/setup.rb").read.split("\n").select {|line| line.start_with?("$:.unshift") } @@ -187,7 +187,7 @@ RSpec.shared_examples "bundle install --standalone" do describe "with Gemfiles using absolute path sources and resulting bundle moved to a folder hierarchy with different nesting" do before do - build_lib "minitest", "1.0.0", :path => lib_path("minitest") + build_lib "minitest", "1.0.0", path: lib_path("minitest") Dir.mkdir bundled_app("app") @@ -196,14 +196,14 @@ RSpec.shared_examples "bundle install --standalone" do gem "minitest", :path => "#{lib_path("minitest")}" G - bundle "install", :standalone => true, :dir => bundled_app("app") + bundle "install", standalone: true, dir: bundled_app("app") Dir.mkdir tmp("one_more_level") FileUtils.mv bundled_app, tmp("one_more_level") end it "also works" do - ruby <<-RUBY, :dir => tmp("one_more_level/bundled_app/app") + ruby <<-RUBY, dir: tmp("one_more_level/bundled_app/app") require "./bundle/bundler/setup" require "minitest" @@ -219,20 +219,20 @@ RSpec.shared_examples "bundle install --standalone" do before do FileUtils.mkdir_p bundled_app("app/vendor") - build_lib "minitest", "1.0.0", :path => bundled_app("app/vendor/minitest") + build_lib "minitest", "1.0.0", path: bundled_app("app/vendor/minitest") gemfile bundled_app("app/Gemfile"), <<-G source "#{file_uri_for(gem_repo1)}" gem "minitest", :path => "vendor/minitest" G - bundle "install", :standalone => true, :dir => bundled_app("app") + bundle "install", standalone: true, dir: bundled_app("app") FileUtils.mv(bundled_app("app"), bundled_app2("app")) end it "also works" do - ruby <<-RUBY, :dir => bundled_app2("app") + ruby <<-RUBY, dir: bundled_app2("app") require "./bundle/bundler/setup" require "minitest" @@ -247,7 +247,7 @@ RSpec.shared_examples "bundle install --standalone" do describe "with gems with native extension" do before do bundle "config set --local path #{bundled_app("bundle")}" - install_gemfile <<-G, :standalone => true, :dir => cwd + install_gemfile <<-G, standalone: true, dir: cwd source "#{file_uri_for(gem_repo1)}" gem "very_simple_binary" G @@ -267,7 +267,7 @@ RSpec.shared_examples "bundle install --standalone" do describe "with gem that has an invalid gemspec" do before 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 lib = File.expand_path('lib/', __dir__) @@ -285,7 +285,7 @@ RSpec.shared_examples "bundle install --standalone" do G end bundle "config set --local path #{bundled_app("bundle")}" - install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false + install_gemfile <<-G, standalone: true, dir: cwd, raise_on_error: false source "#{file_uri_for(gem_repo1)}" gem "bar", :git => "#{lib_path("bar-1.0")}" G @@ -307,7 +307,7 @@ RSpec.shared_examples "bundle install --standalone" do gem "devise", :git => "#{lib_path("devise-1.0")}" G bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :dir => cwd + bundle :install, standalone: true, dir: cwd end let(:expected_gems) do @@ -335,7 +335,7 @@ RSpec.shared_examples "bundle install --standalone" do end G bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :dir => cwd + bundle :install, standalone: true, dir: cwd end let(:expected_gems) do @@ -349,7 +349,7 @@ RSpec.shared_examples "bundle install --standalone" do it "allows creating a standalone file with limited groups" do bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => "default", :dir => cwd + bundle :install, standalone: "default", dir: cwd load_error_ruby <<-RUBY, "spec" $:.unshift File.expand_path("bundle") @@ -367,7 +367,7 @@ RSpec.shared_examples "bundle install --standalone" do it "allows `without` configuration to limit the groups used in a standalone" do bundle "config set --local path #{bundled_app("bundle")}" bundle "config set --local without test" - bundle :install, :standalone => true, :dir => cwd + bundle :install, standalone: true, dir: cwd load_error_ruby <<-RUBY, "spec" $:.unshift File.expand_path("bundle") @@ -384,7 +384,7 @@ RSpec.shared_examples "bundle install --standalone" do it "allows `path` configuration to change the location of the standalone bundle" do bundle "config set --local path path/to/bundle" - bundle "install", :standalone => true, :dir => cwd + bundle "install", standalone: true, dir: cwd ruby <<-RUBY $:.unshift File.expand_path("path/to/bundle") @@ -399,9 +399,9 @@ RSpec.shared_examples "bundle install --standalone" do it "allows `without` to limit the groups used in a standalone" do bundle "config set --local without test" - bundle :install, :dir => cwd + bundle :install, dir: cwd bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :dir => cwd + bundle :install, standalone: true, dir: cwd load_error_ruby <<-RUBY, "spec" $:.unshift File.expand_path("bundle") @@ -427,7 +427,7 @@ RSpec.shared_examples "bundle install --standalone" do gem "rails" G bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :artifice => "endpoint", :dir => cwd + bundle :install, standalone: true, artifice: "endpoint", dir: cwd end let(:expected_gems) do @@ -441,14 +441,14 @@ RSpec.shared_examples "bundle install --standalone" do end end - describe "with --binstubs", :bundler => "< 3" do + describe "with --binstubs", bundler: "< 3" do before do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" G bundle "config set --local path #{bundled_app("bundle")}" - bundle :install, :standalone => true, :binstubs => true, :dir => cwd + bundle :install, standalone: true, binstubs: true, dir: cwd end let(:expected_gems) do @@ -466,7 +466,7 @@ RSpec.shared_examples "bundle install --standalone" do it "creates stubs that can be executed from anywhere" do require "tmpdir" - sys_exec(%(#{bundled_app("bin/rails")} -v), :dir => Dir.tmpdir) + sys_exec(%(#{bundled_app("bin/rails")} -v), dir: Dir.tmpdir) expect(out).to eq("2.3.2") end @@ -508,7 +508,7 @@ RSpec.describe "bundle install --standalone --local" do gem "rack" G - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path end it "generates script pointing to system gems" do diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb index 7b58ea9839..51aa0ed14f 100644 --- a/spec/bundler/install/gemspecs_spec.rb +++ b/spec/bundler/install/gemspecs_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle install" do describe "when a gem has a YAML gemspec" do before :each do build_repo2 do - build_gem "yaml_spec", :gemspec => :yaml + build_gem "yaml_spec", gemspec: :yaml end end @@ -18,7 +18,7 @@ RSpec.describe "bundle install" do end it "still installs correctly when using path" do - build_lib "yaml_spec", :gemspec => :yaml + build_lib "yaml_spec", gemspec: :yaml install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -34,7 +34,7 @@ RSpec.describe "bundle install" do gem 'rack' G - system_gems "rack-1.0.0", :path => default_bundle_path + system_gems "rack-1.0.0", path: default_bundle_path FileUtils.mkdir_p "#{default_bundle_path}/specifications" File.open("#{default_bundle_path}/specifications/rack-1.0.0.gemspec", "w+") do |f| @@ -45,7 +45,7 @@ RSpec.describe "bundle install" do end f.write spec.to_ruby end - bundle :install, :artifice => "endpoint_marshal_fail" # force gemspec load + bundle :install, artifice: "endpoint_marshal_fail" # force gemspec load expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.2" end @@ -59,7 +59,7 @@ RSpec.describe "bundle install" do end G - install_gemfile <<-G, :env => { "LANG" => "C" } + install_gemfile <<-G, env: { "LANG" => "C" } source "#{file_uri_for(gem_repo1)}" gemspec G @@ -95,8 +95,8 @@ RSpec.describe "bundle install" do context "when ruby version is specified in gemspec and gemfile" do it "installs when patch level is not specified and the version matches", - :if => RUBY_PATCHLEVEL >= 0 do - build_lib("foo", :path => bundled_app) do |s| + if: RUBY_PATCHLEVEL >= 0 do + build_lib("foo", path: bundled_app) do |s| s.required_ruby_version = "~> #{RUBY_VERSION}.0" end @@ -109,12 +109,12 @@ RSpec.describe "bundle install" do end it "installs when patch level is specified and the version still matches the current version", - :if => RUBY_PATCHLEVEL >= 0 do - build_lib("foo", :path => bundled_app) do |s| + if: RUBY_PATCHLEVEL >= 0 do + build_lib("foo", path: bundled_app) do |s| s.required_ruby_version = "#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}" end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{RUBY_PATCHLEVEL}' source "#{file_uri_for(gem_repo1)}" gemspec @@ -123,13 +123,13 @@ RSpec.describe "bundle install" do end it "fails and complains about patchlevel on patchlevel mismatch", - :if => RUBY_PATCHLEVEL >= 0 do + if: RUBY_PATCHLEVEL >= 0 do patchlevel = RUBY_PATCHLEVEL.to_i + 1 - build_lib("foo", :path => bundled_app) do |s| + build_lib("foo", path: bundled_app) do |s| s.required_ruby_version = "#{RUBY_VERSION}.#{patchlevel}" end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{patchlevel}' source "#{file_uri_for(gem_repo1)}" gemspec @@ -143,11 +143,11 @@ RSpec.describe "bundle install" do it "fails and complains about version on version mismatch" do version = Gem::Requirement.create(RUBY_VERSION).requirements.first.last.bump.version - build_lib("foo", :path => bundled_app) do |s| + build_lib("foo", path: bundled_app) do |s| s.required_ruby_version = version end - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false ruby '#{version}', :engine_version => '#{version}', :engine => 'ruby' source "#{file_uri_for(gem_repo1)}" gemspec diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb index 954fd39efe..c8d574baf3 100644 --- a/spec/bundler/install/git_spec.rb +++ b/spec/bundler/install/git_spec.rb @@ -3,51 +3,51 @@ RSpec.describe "bundle install" do context "git sources" do it "displays the revision hash of the gem repository" do - build_git "foo", "1.0", :path => lib_path("foo") + build_git "foo", "1.0", path: lib_path("foo") - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" G expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{revision_for(lib_path("foo"))[0..6]})") - expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end - it "displays the correct default branch", :git => ">= 2.28.0" do - build_git "foo", "1.0", :path => lib_path("foo"), :default_branch => "main" + it "displays the correct default branch", git: ">= 2.28.0" do + build_git "foo", "1.0", path: lib_path("foo"), default_branch: "main" - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" G expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{revision_for(lib_path("foo"))[0..6]})") - expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end it "displays the ref of the gem repository when using branch~num as a ref" do skip "maybe branch~num notation doesn't work on Windows' git" if Gem.win_platform? - build_git "foo", "1.0", :path => lib_path("foo") + build_git "foo", "1.0", path: lib_path("foo") rev = revision_for(lib_path("foo"))[0..6] - update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true + update_git "foo", "2.0", path: lib_path("foo"), gemspec: true rev2 = revision_for(lib_path("foo"))[0..6] - update_git "foo", "3.0", :path => lib_path("foo"), :gemspec => true + update_git "foo", "3.0", path: lib_path("foo"), gemspec: true - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo"))}", :ref => "main~2" G expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev})") - expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" - update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true + update_git "foo", "4.0", path: lib_path("foo"), gemspec: true - bundle :update, :all => true, :verbose => true + bundle :update, all: true, verbose: true expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at main~2@#{rev2})") - expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 2.0", source: "git@#{lib_path("foo")}" end it "should allows git repos that are missing but not being installed" do @@ -81,9 +81,9 @@ RSpec.describe "bundle install" do it "allows multiple gems from the same git source" do build_repo2 do - build_lib "foo", "1.0", :path => lib_path("gems/foo") - build_lib "zebra", "2.0", :path => lib_path("gems/zebra") - build_git "gems", :path => lib_path("gems"), :gemspec => false + build_lib "foo", "1.0", path: lib_path("gems/foo") + build_lib "zebra", "2.0", path: lib_path("gems/zebra") + build_git "gems", path: lib_path("gems"), gemspec: false end install_gemfile <<-G @@ -106,8 +106,8 @@ RSpec.describe "bundle install" do # NOTE: both gems MUST have the same path! It has to be two gems in one repo. - test = build_git "test", "1.0.0", :path => lib_path("test-and-other") - other = build_git "other", "1.0.0", :path => lib_path("test-and-other") + test = build_git "test", "1.0.0", path: lib_path("test-and-other") + other = build_git "other", "1.0.0", path: lib_path("test-and-other") test_ref = test.ref_for("HEAD") other_ref = other.ref_for("HEAD") @@ -172,34 +172,34 @@ RSpec.describe "bundle install" do end it "allows older revisions of git source when clean true" do - build_git "foo", "1.0", :path => lib_path("foo") + build_git "foo", "1.0", path: lib_path("foo") rev = revision_for(lib_path("foo")) bundle "config set path vendor/bundle" bundle "config set clean true" - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo1)}" gem "foo", :git => "#{file_uri_for(lib_path("foo"))}" G expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{rev[0..6]})") - expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" old_lockfile = lockfile - update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true + update_git "foo", "2.0", path: lib_path("foo"), gemspec: true rev2 = revision_for(lib_path("foo")) - bundle :update, :all => true, :verbose => true + bundle :update, all: true, verbose: true expect(out).to include("Using foo 2.0 (was 1.0) from #{file_uri_for(lib_path("foo"))} (at main@#{rev2[0..6]})") expect(out).to include("Removing foo (#{rev[0..11]})") - expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 2.0", source: "git@#{lib_path("foo")}" lockfile(old_lockfile) - bundle :install, :verbose => true + bundle :install, verbose: true expect(out).to include("Using foo 1.0 from #{file_uri_for(lib_path("foo"))} (at main@#{rev[0..6]})") - expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" + expect(the_bundle).to include_gems "foo 1.0", source: "git@#{lib_path("foo")}" end end end diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb index be43dc5963..f482812f52 100644 --- a/spec/bundler/install/global_cache_spec.rb +++ b/spec/bundler/install/global_cache_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "global gem caching" do end it "caches gems into the global cache on download" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "#{source}" gem "rack" G @@ -29,7 +29,7 @@ RSpec.describe "global gem caching" do source_global_cache.mkpath FileUtils.cp(gem_repo1("gems/rack-1.0.0.gem"), source_global_cache("rack-1.0.0.gem")) - install_gemfile <<-G, :artifice => "compact_index_no_gem" + install_gemfile <<-G, artifice: "compact_index_no_gem" source "#{source}" gem "rack" G @@ -41,7 +41,7 @@ RSpec.describe "global gem caching" do source_global_cache.mkpath FileUtils.touch(source_global_cache("rack-1.0.0.gem")) - install_gemfile <<-G, :artifice => "compact_index_no_gem", :raise_on_error => false + install_gemfile <<-G, artifice: "compact_index_no_gem", raise_on_error: false source "#{source}" gem "rack" G @@ -51,7 +51,7 @@ RSpec.describe "global gem caching" do describe "when the same gem from different sources is installed" do it "should use the appropriate one from the global cache" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "#{source}" gem "rack" G @@ -61,7 +61,7 @@ RSpec.describe "global gem caching" do expect(source_global_cache("rack-1.0.0.gem")).to exist # rack 1.0.0 is not installed and it is in the global cache - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "#{source2}" gem "rack", "0.9.1" G @@ -76,7 +76,7 @@ RSpec.describe "global gem caching" do gem "rack", "1.0.0" G - bundle :install, :artifice => "compact_index_no_gem" + bundle :install, artifice: "compact_index_no_gem" # rack 1.0.0 is installed and rack 0.9.1 is not expect(the_bundle).to include_gems "rack 1.0.0" expect(the_bundle).not_to include_gems "rack 0.9.1" @@ -87,7 +87,7 @@ RSpec.describe "global gem caching" do gem "rack", "0.9.1" G - bundle :install, :artifice => "compact_index_no_gem" + bundle :install, artifice: "compact_index_no_gem" # rack 0.9.1 is installed and rack 1.0.0 is not expect(the_bundle).to include_gems "rack 0.9.1" expect(the_bundle).not_to include_gems "rack 1.0.0" @@ -99,7 +99,7 @@ RSpec.describe "global gem caching" do gem "rack" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" simulate_new_machine expect(the_bundle).not_to include_gems "rack 1.0.0" expect(source_global_cache("rack-1.0.0.gem")).to exist @@ -110,7 +110,7 @@ RSpec.describe "global gem caching" do gem "rack", "0.9.1" G - bundle :install, :artifice => "compact_index" + bundle :install, artifice: "compact_index" simulate_new_machine expect(the_bundle).not_to include_gems "rack 0.9.1" expect(source2_global_cache("rack-0.9.1.gem")).to exist @@ -123,7 +123,7 @@ RSpec.describe "global gem caching" do expect(source_global_cache("rack-1.0.0.gem")).to exist expect(source2_global_cache("rack-0.9.1.gem")).to exist - bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false + bundle :install, artifice: "compact_index_no_gem", raise_on_error: false expect(err).to include("Internal Server Error 500") expect(err).not_to include("ERROR REPORT TEMPLATE") @@ -138,7 +138,7 @@ RSpec.describe "global gem caching" do expect(source_global_cache("rack-1.0.0.gem")).to exist expect(source2_global_cache("rack-0.9.1.gem")).to exist - bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false + bundle :install, artifice: "compact_index_no_gem", raise_on_error: false expect(err).to include("Internal Server Error 500") expect(err).not_to include("ERROR REPORT TEMPLATE") @@ -150,7 +150,7 @@ RSpec.describe "global gem caching" do describe "when installing gems from a different directory" do it "uses the global cache as a source" do - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, artifice: "compact_index" source "#{source}" gem "rack" gem "activesupport" @@ -166,7 +166,7 @@ RSpec.describe "global gem caching" do expect(the_bundle).not_to include_gems "rack 1.0.0" expect(the_bundle).not_to include_gems "activesupport 2.3.5" - install_gemfile <<-G, :artifice => "compact_index_no_gem" + install_gemfile <<-G, artifice: "compact_index_no_gem" source "#{source}" gem "rack" G @@ -183,18 +183,18 @@ RSpec.describe "global gem caching" do G # Neither gem is installed and both are in the global cache - expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2 - expect(the_bundle).not_to include_gems "activesupport 2.3.5", :dir => bundled_app2 + expect(the_bundle).not_to include_gems "rack 1.0.0", dir: bundled_app2 + expect(the_bundle).not_to include_gems "activesupport 2.3.5", dir: bundled_app2 expect(source_global_cache("rack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist # Install using the global cache instead of by downloading the .gem # from the server - bundle :install, :artifice => "compact_index_no_gem", :dir => bundled_app2 + bundle :install, artifice: "compact_index_no_gem", dir: bundled_app2 # activesupport is installed and both are in the global cache - expect(the_bundle).not_to include_gems "rack 1.0.0", :dir => bundled_app2 - expect(the_bundle).to include_gems "activesupport 2.3.5", :dir => bundled_app2 + expect(the_bundle).not_to include_gems "rack 1.0.0", dir: bundled_app2 + expect(the_bundle).to include_gems "activesupport 2.3.5", dir: bundled_app2 expect(source_global_cache("rack-1.0.0.gem")).to exist expect(source_global_cache("activesupport-2.3.5.gem")).to exist diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb index bd5385b265..0a30e402b7 100644 --- a/spec/bundler/install/path_spec.rb +++ b/spec/bundler/install/path_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle install" do describe "with path configured" do before :each do - build_gem "rack", "1.0.0", :to_system => true do |s| + build_gem "rack", "1.0.0", to_system: true do |s| s.write "lib/rack.rb", "puts 'FAIL'" end @@ -23,7 +23,7 @@ RSpec.describe "bundle install" do bundle "config set --local path.system true" bundle "config set --global path vendor/bundle" bundle :install - run "require 'rack'", :raise_on_error => false + run "require 'rack'", raise_on_error: false expect(out).to include("FAIL") end @@ -32,7 +32,7 @@ RSpec.describe "bundle install" do dir.mkpath bundle "config set --local path #{dir.join("vendor/bundle")}" - bundle :install, :dir => dir + bundle :install, dir: dir expect(out).to include("installed into `./vendor/bundle`") dir.rmtree @@ -44,13 +44,13 @@ RSpec.describe "bundle install" do expect(out).to include("gems are installed into `./vendor/bundle`") end - it "disallows --path vendor/bundle --system", :bundler => "< 3" do - bundle "install --path vendor/bundle --system", :raise_on_error => false + it "disallows --path vendor/bundle --system", bundler: "< 3" do + bundle "install --path vendor/bundle --system", raise_on_error: false expect(err).to include("Please choose only one option.") expect(exitstatus).to eq(15) end - it "remembers to disable system gems after the first time with bundle --path vendor/bundle", :bundler => "< 3" do + it "remembers to disable system gems after the first time with bundle --path vendor/bundle", bundler: "< 3" do bundle "install --path vendor/bundle" FileUtils.rm_rf bundled_app("vendor") bundle "install" @@ -62,22 +62,22 @@ RSpec.describe "bundle install" do context "with path_relative_to_cwd set to true" do before { bundle "config set path_relative_to_cwd true" } - it "installs the bundle relatively to current working directory", :bundler => "< 3" do - bundle "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", :dir => bundled_app.parent + it "installs the bundle relatively to current working directory", bundler: "< 3" do + bundle "install --gemfile='#{bundled_app}/Gemfile' --path vendor/bundle", dir: bundled_app.parent expect(out).to include("installed into `./vendor/bundle`") expect(bundled_app("../vendor/bundle")).to be_directory expect(the_bundle).to include_gems "rack 1.0.0" end it "installs the standalone bundle relative to the cwd" do - bundle :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app.parent + bundle :install, gemfile: bundled_app_gemfile, standalone: true, dir: bundled_app.parent expect(out).to include("installed into `./bundled_app/bundle`") expect(bundled_app("bundle")).to be_directory expect(bundled_app("bundle/ruby")).to be_directory bundle "config unset path" - bundle :install, :gemfile => bundled_app_gemfile, :standalone => true, :dir => bundled_app("subdir").tap(&:mkpath) + bundle :install, gemfile: bundled_app_gemfile, standalone: true, dir: bundled_app("subdir").tap(&:mkpath) expect(out).to include("installed into `../bundle`") expect(bundled_app("bundle")).to be_directory expect(bundled_app("bundle/ruby")).to be_directory @@ -87,7 +87,7 @@ RSpec.describe "bundle install" do describe "when BUNDLE_PATH or the global path config is set" do before :each do - build_lib "rack", "1.0.0", :to_system => true do |s| + build_lib "rack", "1.0.0", to_system: true do |s| s.write "lib/rack.rb", "raise 'FAIL'" end @@ -141,7 +141,7 @@ RSpec.describe "bundle install" do set_bundle_path(type, "vendor") FileUtils.mkdir_p bundled_app("lol") - bundle :install, :dir => bundled_app("lol") + bundle :install, dir: bundled_app("lol") expect(bundled_app("vendor", Bundler.ruby_scope, "gems/rack-1.0.0")).to be_directory expect(the_bundle).to include_gems "rack 1.0.0" @@ -168,7 +168,7 @@ RSpec.describe "bundle install" do it "disables system gems when passing a path to install" do # This is so that vendored gems can be distributed to others - build_gem "rack", "1.1.0", :to_system => true + build_gem "rack", "1.1.0", to_system: true bundle "config set --local path ./vendor/bundle" bundle :install @@ -177,7 +177,7 @@ RSpec.describe "bundle install" do end it "re-installs gems whose extensions have been deleted" do - build_lib "very_simple_binary", "1.0.0", :to_system => true do |s| + build_lib "very_simple_binary", "1.0.0", to_system: true do |s| s.write "lib/very_simple_binary.rb", "raise 'FAIL'" end @@ -191,11 +191,11 @@ RSpec.describe "bundle install" do expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory expect(vendored_gems("extensions")).to be_directory - expect(the_bundle).to include_gems "very_simple_binary 1.0", :source => "remote1" + expect(the_bundle).to include_gems "very_simple_binary 1.0", source: "remote1" vendored_gems("extensions").rmtree - run "require 'very_simple_binary_c'", :raise_on_error => false + run "require 'very_simple_binary_c'", raise_on_error: false expect(err).to include("Bundler::GemNotFound") bundle "config set --local path ./vendor/bundle" @@ -203,7 +203,7 @@ RSpec.describe "bundle install" do expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory expect(vendored_gems("extensions")).to be_directory - expect(the_bundle).to include_gems "very_simple_binary 1.0", :source => "remote1" + expect(the_bundle).to include_gems "very_simple_binary 1.0", source: "remote1" end end @@ -219,7 +219,7 @@ RSpec.describe "bundle install" do G bundle "config set --local path bundle" - bundle :install, :raise_on_error => false + bundle :install, raise_on_error: false expect(err).to include("file already exists") end end diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb index a936b2b536..3a72c356d9 100644 --- a/spec/bundler/install/redownload_spec.rb +++ b/spec/bundler/install/redownload_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "bundle install" do end end - describe "with --force", :bundler => 2 do + describe "with --force", bundler: 2 do it_behaves_like "an option to force redownloading gems" do let(:flag) { "force" } end diff --git a/spec/bundler/install/security_policy_spec.rb b/spec/bundler/install/security_policy_spec.rb index 43c3069c4e..befeb81da5 100644 --- a/spec/bundler/install/security_policy_spec.rb +++ b/spec/bundler/install/security_policy_spec.rb @@ -16,23 +16,23 @@ RSpec.describe "policies with unsigned gems" do end it "will work after you try to deploy without a lock" do - bundle "install --deployment", :raise_on_error => false + bundle "install --deployment", raise_on_error: false bundle :install expect(the_bundle).to include_gems "rack 1.0", "signed_gem 1.0" end it "will fail when given invalid security policy" do - bundle "install --trust-policy=InvalidPolicyName", :raise_on_error => false + bundle "install --trust-policy=InvalidPolicyName", raise_on_error: false expect(err).to include("RubyGems doesn't know about trust policy") end it "will fail with High Security setting due to presence of unsigned gem" do - bundle "install --trust-policy=HighSecurity", :raise_on_error => false + bundle "install --trust-policy=HighSecurity", raise_on_error: false expect(err).to include("security policy didn't allow") end it "will fail with Medium Security setting due to presence of unsigned gem" do - bundle "install --trust-policy=MediumSecurity", :raise_on_error => false + bundle "install --trust-policy=MediumSecurity", raise_on_error: false expect(err).to include("security policy didn't allow") end @@ -51,12 +51,12 @@ RSpec.describe "policies with signed gems and no CA" do end it "will fail with High Security setting, gem is self-signed" do - bundle "install --trust-policy=HighSecurity", :raise_on_error => false + bundle "install --trust-policy=HighSecurity", raise_on_error: false expect(err).to include("security policy didn't allow") end it "will fail with Medium Security setting, gem is self-signed" do - bundle "install --trust-policy=MediumSecurity", :raise_on_error => false + bundle "install --trust-policy=MediumSecurity", raise_on_error: false expect(err).to include("security policy didn't allow") end diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb index dc054b50bb..5aeabd2f23 100644 --- a/spec/bundler/install/yanked_spec.rb +++ b/spec/bundler/install/yanked_spec.rb @@ -22,7 +22,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do L - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo4)}" gem "foo", "10.0.0" G @@ -79,7 +79,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do let(:source_uri) { file_uri_for(gem_repo4) } it "reports the yanked gem properly" do - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to include("Your bundle is locked to nokogiri (1.13.8-#{Bundler.local_platform})") end @@ -89,7 +89,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do let(:source_uri) { "https://gem.repo4" } it "reports the yanked gem properly" do - bundle "install", :artifice => "compact_index", :raise_on_error => false + bundle "install", artifice: "compact_index", raise_on_error: false expect(err).to include("Your bundle is locked to nokogiri (1.13.8-#{Bundler.local_platform})") end @@ -99,7 +99,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do it "throws the original error when only the Gemfile specifies a gem version that doesn't exist" do bundle "config set force_ruby_platform true" - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo4)}" gem "foo", "10.0.0" G @@ -186,7 +186,7 @@ RSpec.context "when using gem before installing" do rack (= 0.9.1) L - bundle :list, :raise_on_error => false + bundle :list, raise_on_error: false expect(err).to include("Could not find rack-0.9.1 in locally installed gems") expect(err).to_not include("Your bundle is locked to rack (0.9.1) from") @@ -196,7 +196,7 @@ RSpec.context "when using gem before installing" do # Check error message is still correct when multiple platforms are locked lockfile lockfile.gsub(/PLATFORMS\n #{lockfile_platforms}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}") - bundle :list, :raise_on_error => false + bundle :list, raise_on_error: false expect(err).to include("Could not find rack-0.9.1 in locally installed gems") end @@ -222,7 +222,7 @@ RSpec.context "when using gem before installing" do rack_middleware (1.0) L - bundle :list, :raise_on_error => false + bundle :list, raise_on_error: false expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in locally installed gems") expect(err).to include("Install missing gems with `bundle install`.") diff --git a/spec/bundler/lock/git_spec.rb b/spec/bundler/lock/git_spec.rb index ac3d10223c..ad13e8ffc6 100644 --- a/spec/bundler/lock/git_spec.rb +++ b/spec/bundler/lock/git_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundle lock with git gems" do gem 'foo', :git => "#{lib_path("foo-1.0")}", :branch => "bad" G - bundle "lock --update foo", :env => { "LANG" => "en" }, :raise_on_error => false + bundle "lock --update foo", env: { "LANG" => "en" }, raise_on_error: false expect(err).to include("Revision bad does not exist in the repository") end @@ -55,7 +55,7 @@ RSpec.describe "bundle lock with git gems" do #{Bundler::VERSION} L - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to include("Revision #{"a" * 40} does not exist in the repository") end @@ -75,7 +75,7 @@ RSpec.describe "bundle lock with git gems" do it "properly clones a git source locked to an out of date ref" do update_git "foo" - bundle :install, :env => { "BUNDLE_PATH" => "foo" } + bundle :install, env: { "BUNDLE_PATH" => "foo" } expect(err).to be_empty end diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index f32b039906..07c22db36e 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -58,7 +58,7 @@ RSpec.describe "the lockfile format" do 1.8.2 L - install_gemfile <<-G, :verbose => true, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + install_gemfile <<-G, verbose: true, env: { "BUNDLER_VERSION" => Bundler::VERSION } source "#{file_uri_for(gem_repo2)}" gem "rack" @@ -84,7 +84,7 @@ RSpec.describe "the lockfile format" do G end - it "does not update the lockfile's bundler version if nothing changed during bundle install, but uses the locked version", :rubygems => ">= 3.3.0.a", :realworld => true do + it "does not update the lockfile's bundler version if nothing changed during bundle install, but uses the locked version", rubygems: ">= 3.3.0.a", realworld: true do version = "2.3.0" lockfile <<-L @@ -103,7 +103,7 @@ RSpec.describe "the lockfile format" do #{version} L - install_gemfile <<-G, :verbose => true, :artifice => "vcr" + install_gemfile <<-G, verbose: true, artifice: "vcr" source "#{file_uri_for(gem_repo2)}" gem "rack" @@ -129,7 +129,7 @@ RSpec.describe "the lockfile format" do G end - it "does not update the lockfile's bundler version if nothing changed during bundle install, and uses the latest version", :rubygems => "< 3.3.0.a" do + it "does not update the lockfile's bundler version if nothing changed during bundle install, and uses the latest version", rubygems: "< 3.3.0.a" do version = "#{Bundler::VERSION.split(".").first}.0.0.a" checksums = checksums_section do |c| @@ -152,7 +152,7 @@ RSpec.describe "the lockfile format" do #{version} L - install_gemfile <<-G, :verbose => true + install_gemfile <<-G, verbose: true source "#{file_uri_for(gem_repo2)}" gem "rack" @@ -237,7 +237,7 @@ RSpec.describe "the lockfile format" do #{older_major} L - install_gemfile <<-G, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + install_gemfile <<-G, env: { "BUNDLER_VERSION" => Bundler::VERSION } source "#{file_uri_for(gem_repo2)}/" gem "rack" @@ -327,7 +327,7 @@ RSpec.describe "the lockfile format" do it "generates a lockfile without credentials for a configured source" do bundle "config set http://localgemserver.test/ user:pass" - install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true) + install_gemfile(<<-G, artifice: "endpoint_strict_basic_authentication", quiet: true) source "#{file_uri_for(gem_repo1)}" source "http://localgemserver.test/" do @@ -438,7 +438,7 @@ RSpec.describe "the lockfile format" do end it "does not asplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do - build_lib "omg", :path => lib_path("omg") + build_lib "omg", path: lib_path("omg") gemfile <<-G source "#{file_uri_for(gem_repo2)}/" @@ -514,7 +514,7 @@ RSpec.describe "the lockfile format" do it "generates a lockfile with a ref for a single pinned source, git gem with a branch requirement" do git = build_git "foo" - update_git "foo", :branch => "omg" + update_git "foo", branch: "omg" checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -550,7 +550,7 @@ RSpec.describe "the lockfile format" do it "generates a lockfile with a ref for a single pinned source, git gem with a tag requirement" do git = build_git "foo" - update_git "foo", :tag => "omg" + update_git "foo", tag: "omg" checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -592,26 +592,26 @@ RSpec.describe "the lockfile format" do FileUtils.mkdir_p lib_path("ckeditor/lib") - @remote = build_git("ckeditor_remote", :bare => true) + @remote = build_git("ckeditor_remote", bare: true) - build_git "ckeditor", :path => lib_path("ckeditor") do |s| + build_git "ckeditor", path: lib_path("ckeditor") do |s| s.write "lib/ckeditor.rb", "CKEDITOR = '4.0.7'" s.version = "4.0.7" s.add_dependency "orm_adapter" end - update_git "ckeditor", :path => lib_path("ckeditor"), :remote => file_uri_for(@remote.path) - update_git "ckeditor", :path => lib_path("ckeditor"), :tag => "v4.0.7" - old_git = update_git "ckeditor", :path => lib_path("ckeditor"), :push => "v4.0.7" + update_git "ckeditor", path: lib_path("ckeditor"), remote: file_uri_for(@remote.path) + update_git "ckeditor", path: lib_path("ckeditor"), tag: "v4.0.7" + old_git = update_git "ckeditor", path: lib_path("ckeditor"), push: "v4.0.7" - update_git "ckeditor", :path => lib_path("ckeditor"), :gemspec => true do |s| + update_git "ckeditor", path: lib_path("ckeditor"), gemspec: true do |s| s.write "lib/ckeditor.rb", "CKEDITOR = '4.0.8'" s.version = "4.0.8" s.add_dependency "orm_adapter" end - update_git "ckeditor", :path => lib_path("ckeditor"), :tag => "v4.0.8" + update_git "ckeditor", path: lib_path("ckeditor"), tag: "v4.0.8" - new_git = update_git "ckeditor", :path => lib_path("ckeditor"), :push => "v4.0.8" + new_git = update_git "ckeditor", path: lib_path("ckeditor"), push: "v4.0.8" gemfile <<-G source "#{file_uri_for(gem_repo4)}" @@ -717,7 +717,7 @@ RSpec.describe "the lockfile format" do bundle "config set cache_all true" bundle :cache - bundle :install, :local => true + bundle :install, local: true expect(lockfile).to eq <<~G PATH @@ -913,7 +913,7 @@ RSpec.describe "the lockfile format" do # Capistrano did this (at least until version 2.5.10) # RubyGems 2.2 doesn't allow the specifying of a dependency twice # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f - build_gem "double_deps", "1.0", :skip_validation => true do |s| + build_gem "double_deps", "1.0", skip_validation: true do |s| s.add_dependency "net-ssh", ">= 1.0.0" s.add_dependency "net-ssh" end @@ -1012,7 +1012,7 @@ RSpec.describe "the lockfile format" do end it "stores relative paths when the path is provided in a relative fashion and in Gemfile dir" do - build_lib "foo", :path => bundled_app("foo") + build_lib "foo", path: bundled_app("foo") checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -1047,7 +1047,7 @@ RSpec.describe "the lockfile format" do end it "stores relative paths when the path is provided in a relative fashion and is above Gemfile dir" do - build_lib "foo", :path => bundled_app(File.join("..", "foo")) + build_lib "foo", path: bundled_app(File.join("..", "foo")) checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -1082,7 +1082,7 @@ RSpec.describe "the lockfile format" do end it "stores relative paths when the path is provided in an absolute fashion but is relative" do - build_lib "foo", :path => bundled_app("foo") + build_lib "foo", path: bundled_app("foo") checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -1117,7 +1117,7 @@ RSpec.describe "the lockfile format" do end it "stores relative paths when the path is provided for gemspec" do - build_lib("foo", :path => tmp.join("foo")) + build_lib("foo", path: tmp.join("foo")) checksums = checksums_section_when_existing do |c| c.no_checksum "foo", "1.0" @@ -1185,7 +1185,7 @@ RSpec.describe "the lockfile format" do rack (1.0.0) PLATFORMS - #{lockfile_platforms("java", local_platform, :defaults => [])} + #{lockfile_platforms("java", local_platform, defaults: [])} DEPENDENCIES rack @@ -1351,7 +1351,7 @@ RSpec.describe "the lockfile format" do end it "raises if two different versions are used" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}/" gem "rack", "1.0" gem "rack", "1.1" @@ -1362,7 +1362,7 @@ RSpec.describe "the lockfile format" do end it "raises if two different sources are used" do - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}/" gem "rack" gem "rack", :git => "git://hubz.com" @@ -1444,7 +1444,7 @@ RSpec.describe "the lockfile format" do rack_middleware L - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}" gem "rack_middleware" G @@ -1494,7 +1494,7 @@ RSpec.describe "the lockfile format" do indirect_dependency (1.2.3) PLATFORMS - #{lockfile_platforms("ruby", generic_local_platform, :defaults => [])} + #{lockfile_platforms("ruby", generic_local_platform, defaults: [])} DEPENDENCIES direct_dependency @@ -1536,7 +1536,7 @@ RSpec.describe "the lockfile format" do #{Bundler::VERSION} L - cache_gems "minitest-bisect-1.6.0", "path_expander-1.1.1", :gem_repo => gem_repo4 + cache_gems "minitest-bisect-1.6.0", "path_expander-1.1.1", gem_repo: gem_repo4 bundle :install expect(lockfile).to eq <<~L @@ -1652,7 +1652,7 @@ RSpec.describe "the lockfile format" do end end - expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) } + expect { bundle "update", all: true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).not_to match("\r\n") expect(the_bundle).to include_gems "rack 1.2" end @@ -1670,7 +1670,7 @@ RSpec.describe "the lockfile format" do File.open(bundled_app_lock, "wb") {|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value - expect { bundle "update", :all => true }.to change { File.mtime(bundled_app_lock) } + expect { bundle "update", all: true }.to change { File.mtime(bundled_app_lock) } expect(File.read(bundled_app_lock)).to match("\r\n") expect(the_bundle).to include_gems "rack 1.2" @@ -1723,7 +1723,7 @@ RSpec.describe "the lockfile format" do #{Bundler::VERSION} L - install_gemfile <<-G, :raise_on_error => false + install_gemfile <<-G, raise_on_error: false source "#{file_uri_for(gem_repo2)}/" gem "rack" G diff --git a/spec/bundler/other/cli_dispatch_spec.rb b/spec/bundler/other/cli_dispatch_spec.rb index 2d6080296f..48b285045a 100644 --- a/spec/bundler/other/cli_dispatch_spec.rb +++ b/spec/bundler/other/cli_dispatch_spec.rb @@ -2,19 +2,19 @@ RSpec.describe "bundle command names" do it "work when given fully" do - bundle "install", :raise_on_error => false + bundle "install", raise_on_error: false expect(err).to eq("Could not locate Gemfile") expect(last_command.stdboth).not_to include("Ambiguous command") end it "work when not ambiguous" do - bundle "ins", :raise_on_error => false + bundle "ins", raise_on_error: false expect(err).to eq("Could not locate Gemfile") expect(last_command.stdboth).not_to include("Ambiguous command") end it "print a friendly error when ambiguous" do - bundle "in", :raise_on_error => false + bundle "in", raise_on_error: false expect(err).to eq("Ambiguous command in matches [info, init, inject, install]") end end diff --git a/spec/bundler/other/ext_spec.rb b/spec/bundler/other/ext_spec.rb index 9b829a2b36..4d6ee2edf8 100644 --- a/spec/bundler/other/ext_spec.rb +++ b/spec/bundler/other/ext_spec.rb @@ -59,7 +59,7 @@ RSpec.describe "Gem::SourceIndex#refresh!" do end it "does not explode when called" do - run "Gem.source_index.refresh!", :raise_on_error => false - run "Gem::SourceIndex.new([]).refresh!", :raise_on_error => false + run "Gem.source_index.refresh!", raise_on_error: false + run "Gem::SourceIndex.new([]).refresh!", raise_on_error: false end end diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index 7cc1926253..7dad0e8c3d 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -17,14 +17,14 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_env", bundler: "< 3" do expect(deprecations).to include \ "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \ "(called at -e:1)" end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end describe ".with_clean_env" do @@ -33,7 +33,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_env", bundler: "< 3" do expect(deprecations).to include( "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \ @@ -41,7 +41,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end describe ".clean_system" do @@ -50,7 +50,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_system", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_system", bundler: "< 3" do expect(deprecations).to include( "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \ @@ -58,7 +58,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end describe ".clean_exec" do @@ -67,7 +67,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_exec", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_exec", bundler: "< 3" do expect(deprecations).to include( "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \ @@ -75,7 +75,7 @@ RSpec.describe "major deprecations" do ) end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end describe ".environment" do @@ -84,29 +84,29 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .load", :bundler => "< 3" do + it "is deprecated in favor of .load", bundler: "< 3" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)" end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end end describe "bundle exec --no-keep-file-descriptors" do before do - bundle "exec --no-keep-file-descriptors -e 1", :raise_on_error => false + bundle "exec --no-keep-file-descriptors -e 1", raise_on_error: false end - it "is deprecated", :bundler => "< 3" do + it "is deprecated", bundler: "< 3" do expect(deprecations).to include "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to" end - pending "is removed and shows a helpful error message about it", :bundler => "3" + pending "is removed and shows a helpful error message about it", bundler: "3" end describe "bundle update --quiet" do it "does not print any deprecations" do - bundle :update, :quiet => true, :raise_on_error => false + bundle :update, quiet: true, raise_on_error: false expect(deprecations).to be_empty end end @@ -118,10 +118,10 @@ RSpec.describe "major deprecations" do gem "rack" G - bundle "check --path vendor/bundle", :raise_on_error => false + bundle "check --path vendor/bundle", raise_on_error: false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", bundler: "< 3" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -130,7 +130,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle check --path=" do @@ -140,10 +140,10 @@ RSpec.describe "major deprecations" do gem "rack" G - bundle "check --path=vendor/bundle", :raise_on_error => false + bundle "check --path=vendor/bundle", raise_on_error: false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", bundler: "< 3" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -152,7 +152,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle cache --all" do @@ -162,10 +162,10 @@ RSpec.describe "major deprecations" do gem "rack" G - bundle "cache --all", :raise_on_error => false + bundle "cache --all", raise_on_error: false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", bundler: "< 3" do expect(deprecations).to include( "The `--all` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -174,7 +174,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle cache --path" do @@ -184,10 +184,10 @@ RSpec.describe "major deprecations" do gem "rack" G - bundle "cache --path foo", :raise_on_error => false + bundle "cache --path foo", raise_on_error: false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", bundler: "< 3" do expect(deprecations).to include( "The `--path` flag is deprecated because its semantics are unclear. " \ "Use `bundle config cache_path` to configure the path of your cache of gems, " \ @@ -196,7 +196,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "bundle config" do @@ -205,11 +205,11 @@ RSpec.describe "major deprecations" do bundle "config" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old get interface" do @@ -217,11 +217,11 @@ RSpec.describe "major deprecations" do bundle "config waka" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old set interface" do @@ -229,11 +229,11 @@ RSpec.describe "major deprecations" do bundle "config waka wakapun" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old set interface with --local" do @@ -241,11 +241,11 @@ RSpec.describe "major deprecations" do bundle "config --local waka wakapun" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old set interface with --global" do @@ -253,11 +253,11 @@ RSpec.describe "major deprecations" do bundle "config --global waka wakapun" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old unset interface" do @@ -265,11 +265,11 @@ RSpec.describe "major deprecations" do bundle "config --delete waka" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old unset interface with --local" do @@ -277,11 +277,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --local waka" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end describe "old unset interface with --global" do @@ -289,11 +289,11 @@ RSpec.describe "major deprecations" do bundle "config --delete --global waka" end - it "warns", :bundler => "3" do + it "warns", bundler: "3" do expect(deprecations).to include("Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end end @@ -305,12 +305,12 @@ RSpec.describe "major deprecations" do G end - it "warns when no options are given", :bundler => "3" do + it "warns when no options are given", bundler: "3" do bundle "update" expect(deprecations).to include("Pass --all to `bundle update` to update everything") end - pending "fails with a helpful error when no options are given", :bundler => "3" + pending "fails with a helpful error when no options are given", bundler: "3" it "does not warn when --all is passed" do bundle "update --all" @@ -320,17 +320,17 @@ RSpec.describe "major deprecations" do describe "bundle install --binstubs" do before do - install_gemfile <<-G, :binstubs => true + install_gemfile <<-G, binstubs: true source "#{file_uri_for(gem_repo1)}" gem "rack" G end - it "should output a deprecation warning", :bundler => "< 3" do + it "should output a deprecation warning", bundler: "< 3" do expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle install with both gems.rb and Gemfile present" do @@ -390,7 +390,7 @@ RSpec.describe "major deprecations" do bundle "install #{flag_name} #{value}" end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", bundler: "< 3" do expect(deprecations).to include( "The `#{flag_name}` flag is deprecated because it relies on " \ "being remembered across bundler invocations, which bundler " \ @@ -399,7 +399,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end end end @@ -412,7 +412,7 @@ RSpec.describe "major deprecations" do G end - it "shows a deprecation", :bundler => "< 3" do + it "shows a deprecation", bundler: "< 3" do expect(deprecations).to include( "Your Gemfile contains multiple global sources. " \ "Using `source` more than once without a block is a security risk, and " \ @@ -421,7 +421,7 @@ RSpec.describe "major deprecations" do ) end - it "doesn't show lockfile deprecations if there's a lockfile", :bundler => "< 3" do + it "doesn't show lockfile deprecations if there's a lockfile", bundler: "< 3" do bundle "install" expect(deprecations).to include( @@ -449,7 +449,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do @@ -485,13 +485,13 @@ RSpec.describe "major deprecations" do bundle "config set --local frozen true" end - it "shows a deprecation", :bundler => "< 3" do + it "shows a deprecation", bundler: "< 3" do bundle "install" expect(deprecations).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "when Bundler.setup is run in a ruby script" do @@ -524,14 +524,14 @@ RSpec.describe "major deprecations" do RUBY end - it "should print a capistrano deprecation warning", :bundler => "< 3" do + it "should print a capistrano deprecation warning", bundler: "< 3" do expect(deprecations).to include("Bundler no longer integrates " \ "with Capistrano, but Capistrano provides " \ "its own integration with Bundler via the " \ "capistrano-bundler gem. Use it instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "fails with a helpful error", bundler: "3" end context "bundle show" do @@ -547,11 +547,11 @@ RSpec.describe "major deprecations" do bundle "show --outdated" end - it "prints a deprecation warning informing about its removal", :bundler => "< 3" do + it "prints a deprecation warning informing about its removal", bundler: "< 3" do expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") end - pending "fails with a helpful message", :bundler => "3" + pending "fails with a helpful message", bundler: "3" end end @@ -564,27 +564,27 @@ RSpec.describe "major deprecations" do end context "with --install" do - it "shows a deprecation warning", :bundler => "< 3" do + it "shows a deprecation warning", bundler: "< 3" do bundle "remove rack --install" expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." end - pending "fails with a helpful message", :bundler => "3" + pending "fails with a helpful message", bundler: "3" end end context "bundle console" do before do - bundle "console", :raise_on_error => false + bundle "console", raise_on_error: false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include \ "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" end - pending "fails with a helpful message", :bundler => "3" + pending "fails with a helpful message", bundler: "3" end context "bundle viz", :realworld do @@ -594,20 +594,20 @@ RSpec.describe "major deprecations" do bundle "viz" end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph" end - pending "fails with a helpful message", :bundler => "3" + pending "fails with a helpful message", bundler: "3" end describe "deprecating rubocop", :readline do context "bundle gem --rubocop" do before do - bundle "gem my_new_gem --rubocop", :raise_on_error => false + bundle "gem my_new_gem --rubocop", raise_on_error: false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include \ "--rubocop is deprecated, use --linter=rubocop" end @@ -615,10 +615,10 @@ RSpec.describe "major deprecations" do context "bundle gem --no-rubocop" do before do - bundle "gem my_new_gem --no-rubocop", :raise_on_error => false + bundle "gem my_new_gem --no-rubocop", raise_on_error: false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include \ "--no-rubocop is deprecated, use --linter" end @@ -626,10 +626,10 @@ RSpec.describe "major deprecations" do context "bundle gem with gem.rubocop set to true" do before do - bundle "gem my_new_gem", :env => { "BUNDLE_GEM__RUBOCOP" => "true" }, :raise_on_error => false + bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "true" }, raise_on_error: false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include \ "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead" end @@ -637,10 +637,10 @@ RSpec.describe "major deprecations" do context "bundle gem with gem.rubocop set to false" do before do - bundle "gem my_new_gem", :env => { "BUNDLE_GEM__RUBOCOP" => "false" }, :raise_on_error => false + bundle "gem my_new_gem", env: { "BUNDLE_GEM__RUBOCOP" => "false" }, raise_on_error: false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", bundler: "< 3" do expect(deprecations).to include \ "config gem.rubocop is deprecated; we've updated your config to use gem.linter instead" end diff --git a/spec/bundler/plugins/command_spec.rb b/spec/bundler/plugins/command_spec.rb index 3a7adf4b48..af132d6550 100644 --- a/spec/bundler/plugins/command_spec.rb +++ b/spec/bundler/plugins/command_spec.rb @@ -69,7 +69,7 @@ RSpec.describe "command plugins" do end end - bundle "plugin install copycat --source #{file_uri_for(gem_repo2)}", :raise_on_error => false + bundle "plugin install copycat --source #{file_uri_for(gem_repo2)}", raise_on_error: false expect(out).not_to include("Installed plugin copycat") diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb index aec131f2ee..ca8e2d2e51 100644 --- a/spec/bundler/plugins/install_spec.rb +++ b/spec/bundler/plugins/install_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "bundler plugin install" do end it "shows proper message when gem in not found in the source" do - bundle "plugin install no-foo --source #{file_uri_for(gem_repo1)}", :raise_on_error => false + bundle "plugin install no-foo --source #{file_uri_for(gem_repo1)}", raise_on_error: false expect(err).to include("Could not find") plugin_should_not_be_installed("no-foo") @@ -23,14 +23,14 @@ RSpec.describe "bundler plugin install" do end it "installs from rubygems source in frozen mode" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)}", :env => { "BUNDLE_DEPLOYMENT" => "true" } + bundle "plugin install foo --source #{file_uri_for(gem_repo2)}", env: { "BUNDLE_DEPLOYMENT" => "true" } expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") end it "installs from sources configured as Gem.sources without any flags" do - bundle "plugin install foo", :env => { "BUNDLER_SPEC_GEM_SOURCES" => file_uri_for(gem_repo2).to_s } + bundle "plugin install foo", env: { "BUNDLER_SPEC_GEM_SOURCES" => file_uri_for(gem_repo2).to_s } expect(out).to include("Installed plugin foo") plugin_should_be_installed("foo") @@ -105,7 +105,7 @@ RSpec.describe "bundler plugin install" do end it "raises error when both --branch and --ref options are specified" do - bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --branch main --ref v1.2.3", :raise_on_error => false + bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --branch main --ref v1.2.3", raise_on_error: false expect(out).not_to include("Installed plugin foo") @@ -152,7 +152,7 @@ RSpec.describe "bundler plugin install" do build_gem "charlie" end - bundle "plugin install charlie --source #{file_uri_for(gem_repo2)}", :raise_on_error => false + bundle "plugin install charlie --source #{file_uri_for(gem_repo2)}", raise_on_error: false expect(err).to include("Failed to install plugin `charlie`, due to Bundler::Plugin::MalformattedPlugin (plugins.rb was not found in the plugin.)") @@ -171,7 +171,7 @@ RSpec.describe "bundler plugin install" do end end - bundle "plugin install chaplin --source #{file_uri_for(gem_repo2)}", :raise_on_error => false + bundle "plugin install chaplin --source #{file_uri_for(gem_repo2)}", raise_on_error: false expect(global_plugin_gem("chaplin-1.0")).not_to be_directory @@ -203,7 +203,7 @@ RSpec.describe "bundler plugin install" do end it "raises an error when both git and local git sources are specified" do - bundle "plugin install foo --local_git /phony/path/project --git [email protected]:/repo/project", :raise_on_error => false + bundle "plugin install foo --local_git /phony/path/project --git [email protected]:/repo/project", raise_on_error: false expect(exitstatus).not_to eq(0) expect(err).to eq("Remote and local plugin git sources can't be both specified") @@ -314,7 +314,7 @@ RSpec.describe "bundler plugin install" do end RUBY - ruby code, :env => { "BUNDLER_VERSION" => Bundler::VERSION } + ruby code, env: { "BUNDLER_VERSION" => Bundler::VERSION } expect(local_plugin_gem("foo-1.0", "plugins.rb")).to exist end end @@ -364,7 +364,7 @@ RSpec.describe "bundler plugin install" do end # outside the app - bundle "plugin install fubar --source #{file_uri_for(gem_repo2)}", :dir => tmp + bundle "plugin install fubar --source #{file_uri_for(gem_repo2)}", dir: tmp end it "inside the app takes precedence over global plugin" do @@ -373,7 +373,7 @@ RSpec.describe "bundler plugin install" do end it "outside the app global plugin is used" do - bundle "shout", :dir => tmp + bundle "shout", dir: tmp expect(out).to eq("global_one") end end diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb index 07302e00d7..e569f3e415 100644 --- a/spec/bundler/plugins/source/example_spec.rb +++ b/spec/bundler/plugins/source/example_spec.rb @@ -421,7 +421,7 @@ RSpec.describe "real source plugins" do end it "updates the deps on change in gemfile" do - update_git "ma-gitp-gem", "1.1", :path => lib_path("ma-gitp-gem-1.0"), :gemspec => true + update_git "ma-gitp-gem", "1.1", path: lib_path("ma-gitp-gem-1.0"), gemspec: true gemfile <<-G source "#{file_uri_for(gem_repo2)}" # plugin source source "#{file_uri_for(lib_path("ma-gitp-gem-1.0"))}", :type => :gitp do diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 6b010fe872..a003fc1b27 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -238,6 +238,6 @@ RSpec.describe "The library itself" do private def each_line(filename, &block) - File.readlines(filename, :encoding => "UTF-8").each_with_index(&block) + File.readlines(filename, encoding: "UTF-8").each_with_index(&block) end end diff --git a/spec/bundler/realworld/dependency_api_spec.rb b/spec/bundler/realworld/dependency_api_spec.rb index 14f99bd262..ee5c0e3d0a 100644 --- a/spec/bundler/realworld/dependency_api_spec.rb +++ b/spec/bundler/realworld/dependency_api_spec.rb @@ -2,7 +2,7 @@ require_relative "../support/silent_logger" -RSpec.describe "gemcutter's dependency API", :realworld => true do +RSpec.describe "gemcutter's dependency API", realworld: true do context "when Gemcutter API takes too long to respond" do before do require_rack @@ -13,12 +13,12 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do require_relative "../support/artifice/endpoint_timeout" @t = Thread.new do - server = Rack::Server.start(:app => EndpointTimeout, - :Host => "0.0.0.0", - :Port => port, - :server => "webrick", - :AccessLog => [], - :Logger => Spec::SilentLogger.new) + server = Rack::Server.start(app: EndpointTimeout, + Host: "0.0.0.0", + Port: port, + server: "webrick", + AccessLog: [], + Logger: Spec::SilentLogger.new) server.start end @t.run @@ -34,7 +34,7 @@ RSpec.describe "gemcutter's dependency API", :realworld => true do end it "times out and falls back on the modern index" do - install_gemfile <<-G, :artifice => nil + install_gemfile <<-G, artifice: nil source "#{@server_uri}" gem "rack" G diff --git a/spec/bundler/realworld/double_check_spec.rb b/spec/bundler/realworld/double_check_spec.rb index cfeba26e53..0741560395 100644 --- a/spec/bundler/realworld/double_check_spec.rb +++ b/spec/bundler/realworld/double_check_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "double checking sources", :realworld => true do +RSpec.describe "double checking sources", realworld: true do it "finds already-installed gems" do create_file("rails.gemspec", <<-RUBY) Gem::Specification.new do |s| diff --git a/spec/bundler/realworld/edgecases_spec.rb b/spec/bundler/realworld/edgecases_spec.rb index 6c523556fb..c9af686dbe 100644 --- a/spec/bundler/realworld/edgecases_spec.rb +++ b/spec/bundler/realworld/edgecases_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "real world edgecases", :realworld => true do +RSpec.describe "real world edgecases", realworld: true do def rubygems_version(name, requirement) ruby <<-RUBY require "#{spec_dir}/support/artifice/vcr" @@ -193,13 +193,13 @@ RSpec.describe "real world edgecases", :realworld => true do rails (~> 4.2.7.1) L - bundle "lock --update paperclip", :env => { "BUNDLER_VERSION" => "1.99.0" } + bundle "lock --update paperclip", env: { "BUNDLER_VERSION" => "1.99.0" } expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0")) end - it "outputs a helpful error message when gems have invalid gemspecs", :rubygems => "< 3.3.16" do - install_gemfile <<-G, :standalone => true, :raise_on_error => false, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" } + it "outputs a helpful error message when gems have invalid gemspecs", rubygems: "< 3.3.16" do + install_gemfile <<-G, standalone: true, raise_on_error: false, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" } source 'https://rubygems.org' gem "resque-scheduler", "2.2.0" gem "redis-namespace", "1.6.0" # for a consistent resolution including ruby 2.3.0 @@ -209,8 +209,8 @@ RSpec.describe "real world edgecases", :realworld => true do expect(err).to include("resque-scheduler 2.2.0 has an invalid gemspec") end - it "outputs a helpful warning when gems have a gemspec with invalid `require_paths`", :rubygems => ">= 3.3.16" do - install_gemfile <<-G, :standalone => true, :env => { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" } + it "outputs a helpful warning when gems have a gemspec with invalid `require_paths`", rubygems: ">= 3.3.16" do + install_gemfile <<-G, standalone: true, env: { "BUNDLE_FORCE_RUBY_PLATFORM" => "1" } source 'https://rubygems.org' gem "resque-scheduler", "2.2.0" gem "redis-namespace", "1.6.0" # for a consistent resolution including ruby 2.3.0 @@ -323,10 +323,10 @@ RSpec.describe "real world edgecases", :realworld => true do if Bundler.feature_flag.bundler_3_mode? # Conflicts on bundler version, so we count attempts differently - bundle :lock, :env => { "DEBUG_RESOLVER" => "1" }, :raise_on_error => false + bundle :lock, env: { "DEBUG_RESOLVER" => "1" }, raise_on_error: false expect(out.split("\n").grep(/backtracking to/).count).to eq(8) else - bundle :lock, :env => { "DEBUG_RESOLVER" => "1" } + bundle :lock, env: { "DEBUG_RESOLVER" => "1" } expect(out).to include("Solution found after 7 attempts") end end @@ -348,7 +348,7 @@ RSpec.describe "real world edgecases", :realworld => true do end G - bundle :lock, :env => { "DEBUG_RESOLVER" => "1" } + bundle :lock, env: { "DEBUG_RESOLVER" => "1" } expect(out).to include("Solution found after 6 attempts") end @@ -510,7 +510,7 @@ RSpec.describe "real world edgecases", :realworld => true do gem "zookeeper" G - bundle :lock, :env => { "DEBUG_RESOLVER" => "1" } + bundle :lock, env: { "DEBUG_RESOLVER" => "1" } expect(out).to include("Solution found after 4 attempts") end diff --git a/spec/bundler/realworld/ffi_spec.rb b/spec/bundler/realworld/ffi_spec.rb index fdefc14091..5f40b43a0f 100644 --- a/spec/bundler/realworld/ffi_spec.rb +++ b/spec/bundler/realworld/ffi_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "loading dynamically linked library on a bundle exec context", :realworld => true do +RSpec.describe "loading dynamically linked library on a bundle exec context", realworld: true do it "passes ENV right after argv in memory" do create_file "foo.rb", <<~RUBY require 'ffi' diff --git a/spec/bundler/realworld/fixtures/warbler/Gemfile b/spec/bundler/realworld/fixtures/warbler/Gemfile index 4fbf2d05a7..a8dbb4911c 100644 --- a/spec/bundler/realworld/fixtures/warbler/Gemfile +++ b/spec/bundler/realworld/fixtures/warbler/Gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "demo", :path => "./demo" +gem "demo", path: "./demo" gem "jruby-jars", "~> 9.2" gem "warbler", "~> 2.0" diff --git a/spec/bundler/realworld/gemfile_source_header_spec.rb b/spec/bundler/realworld/gemfile_source_header_spec.rb index ea909411ce..45f5d0fd22 100644 --- a/spec/bundler/realworld/gemfile_source_header_spec.rb +++ b/spec/bundler/realworld/gemfile_source_header_spec.rb @@ -2,7 +2,7 @@ require_relative "../support/silent_logger" -RSpec.describe "fetching dependencies with a mirrored source", :realworld => true do +RSpec.describe "fetching dependencies with a mirrored source", realworld: true do let(:mirror) { "https://server.example.org" } let(:original) { "http://127.0.0.1:#{@port}" } @@ -23,7 +23,7 @@ RSpec.describe "fetching dependencies with a mirrored source", :realworld => tru gem 'weakling' G - bundle :install, :artifice => nil + bundle :install, artifice: nil expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") @@ -40,12 +40,12 @@ RSpec.describe "fetching dependencies with a mirrored source", :realworld => tru require_relative "../support/artifice/endpoint_mirror_source" @t = Thread.new do - Rack::Server.start(:app => EndpointMirrorSource, - :Host => "0.0.0.0", - :Port => @port, - :server => "webrick", - :AccessLog => [], - :Logger => Spec::SilentLogger.new) + Rack::Server.start(app: EndpointMirrorSource, + Host: "0.0.0.0", + Port: @port, + server: "webrick", + AccessLog: [], + Logger: Spec::SilentLogger.new) end.run wait_for_server("127.0.0.1", @port) diff --git a/spec/bundler/realworld/git_spec.rb b/spec/bundler/realworld/git_spec.rb index 3d352626ea..9eff74f1c9 100644 --- a/spec/bundler/realworld/git_spec.rb +++ b/spec/bundler/realworld/git_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "github source", :realworld => true do +RSpec.describe "github source", realworld: true do it "properly fetches PRs" do install_gemfile <<-G source "https://rubygems.org" diff --git a/spec/bundler/realworld/mirror_probe_spec.rb b/spec/bundler/realworld/mirror_probe_spec.rb index f2ce477c10..fc97f92375 100644 --- a/spec/bundler/realworld/mirror_probe_spec.rb +++ b/spec/bundler/realworld/mirror_probe_spec.rb @@ -2,7 +2,7 @@ require_relative "../support/silent_logger" -RSpec.describe "fetching dependencies with a not available mirror", :realworld => true do +RSpec.describe "fetching dependencies with a not available mirror", realworld: true do let(:mirror) { @mirror_uri } let(:original) { @server_uri } let(:server_port) { @server_port } @@ -32,7 +32,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = gem 'weakling' G - bundle :install, :artifice => nil + bundle :install, artifice: nil expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") @@ -52,7 +52,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = gem 'weakling' G - bundle :install, :artifice => nil + bundle :install, artifice: nil expect(out).to include("Installing weakling") expect(out).to include("Bundle complete") @@ -71,7 +71,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = gem 'weakling' G - bundle :install, :artifice => nil, :raise_on_error => false + bundle :install, artifice: nil, raise_on_error: false expect(out).to include("Fetching source index from #{mirror}") @@ -94,7 +94,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = gem 'weakling' G - bundle :install, :artifice => nil, :raise_on_error => false + bundle :install, artifice: nil, raise_on_error: false expect(out).to include("Fetching source index from #{mirror}") @@ -113,12 +113,12 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = require_relative "../support/artifice/endpoint" @server_thread = Thread.new do - Rack::Server.start(:app => Endpoint, - :Host => host, - :Port => @server_port, - :server => "webrick", - :AccessLog => [], - :Logger => Spec::SilentLogger.new) + Rack::Server.start(app: Endpoint, + Host: host, + Port: @server_port, + server: "webrick", + AccessLog: [], + Logger: Spec::SilentLogger.new) end.run wait_for_server(host, @server_port) diff --git a/spec/bundler/realworld/parallel_spec.rb b/spec/bundler/realworld/parallel_spec.rb index a1e4f83909..b57fdfd0ee 100644 --- a/spec/bundler/realworld/parallel_spec.rb +++ b/spec/bundler/realworld/parallel_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "parallel", :realworld => true do +RSpec.describe "parallel", realworld: true do it "installs" do gemfile <<-G source "https://rubygems.org" @@ -9,7 +9,7 @@ RSpec.describe "parallel", :realworld => true do gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+ G - bundle :install, :jobs => 4, :env => { "DEBUG" => "1" } + bundle :install, jobs: 4, env: { "DEBUG" => "1" } expect(out).to match(/[1-3]: /) @@ -34,7 +34,7 @@ RSpec.describe "parallel", :realworld => true do gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+ G - bundle :update, :jobs => 4, :env => { "DEBUG" => "1" }, :all => true + bundle :update, jobs: 4, env: { "DEBUG" => "1" }, all: true expect(out).to match(/[1-3]: /) @@ -51,7 +51,7 @@ RSpec.describe "parallel", :realworld => true do gem "diff-lcs" G - bundle :install, :standalone => true, :jobs => 4 + bundle :install, standalone: true, jobs: 4 ruby <<-RUBY $:.unshift File.expand_path("bundle") diff --git a/spec/bundler/realworld/slow_perf_spec.rb b/spec/bundler/realworld/slow_perf_spec.rb index aa8a48fcc7..d5ca51975a 100644 --- a/spec/bundler/realworld/slow_perf_spec.rb +++ b/spec/bundler/realworld/slow_perf_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -RSpec.describe "bundle install with complex dependencies", :realworld => true do +RSpec.describe "bundle install with complex dependencies", realworld: true do it "resolves quickly" do gemfile <<-G source 'https://rubygems.org' 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 diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index 6d61ef899f..66bdcfa028 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -88,7 +88,7 @@ RSpec.configure do |config| ENV["THOR_COLUMNS"] = "10000" extend(Spec::Helpers) - system_gems :bundler, :path => pristine_system_gem_path + system_gems :bundler, path: pristine_system_gem_path end config.before :all do diff --git a/spec/bundler/support/artifice/compact_index_host_redirect.rb b/spec/bundler/support/artifice/compact_index_host_redirect.rb index 9a711186db..4f82bf3812 100644 --- a/spec/bundler/support/artifice/compact_index_host_redirect.rb +++ b/spec/bundler/support/artifice/compact_index_host_redirect.rb @@ -3,7 +3,7 @@ require_relative "helpers/compact_index" class CompactIndexHostRedirect < CompactIndexAPI - get "/fetch/actual/gem/:id", :host_name => "localgemserver.test" do + get "/fetch/actual/gem/:id", host_name: "localgemserver.test" do redirect "http://bundler.localgemserver.test#{request.path_info}" end diff --git a/spec/bundler/support/artifice/compact_index_partial_update_bad_digest.rb b/spec/bundler/support/artifice/compact_index_partial_update_bad_digest.rb index 72cb579ad4..ac04336636 100644 --- a/spec/bundler/support/artifice/compact_index_partial_update_bad_digest.rb +++ b/spec/bundler/support/artifice/compact_index_partial_update_bad_digest.rb @@ -23,7 +23,7 @@ class CompactIndexPartialUpdateBadDigest < CompactIndexAPI FileUtils.rm_f(file) file = CompactIndex::VersionsFile.new(file.to_s) file.create(gems) - file.contents([], :calculate_info_checksums => true) + file.contents([], calculate_info_checksums: true) end end diff --git a/spec/bundler/support/artifice/compact_index_partial_update_no_digest_not_incremental.rb b/spec/bundler/support/artifice/compact_index_partial_update_no_digest_not_incremental.rb index ce27503741..99bae039f0 100644 --- a/spec/bundler/support/artifice/compact_index_partial_update_no_digest_not_incremental.rb +++ b/spec/bundler/support/artifice/compact_index_partial_update_no_digest_not_incremental.rb @@ -18,7 +18,7 @@ class CompactIndexPartialUpdateNoDigestNotIncremental < CompactIndexAPI FileUtils.rm_f(file) file = CompactIndex::VersionsFile.new(file.to_s) file.create(gems) - lines = file.contents([], :calculate_info_checksums => true).split("\n") + lines = file.contents([], calculate_info_checksums: true).split("\n") name, versions, checksum = lines.last.split(" ") # shuffle versions so new versions are not appended to the end diff --git a/spec/bundler/support/artifice/endpoint_host_redirect.rb b/spec/bundler/support/artifice/endpoint_host_redirect.rb index 0efb6cda02..6ce51bed93 100644 --- a/spec/bundler/support/artifice/endpoint_host_redirect.rb +++ b/spec/bundler/support/artifice/endpoint_host_redirect.rb @@ -3,7 +3,7 @@ require_relative "helpers/endpoint" class EndpointHostRedirect < Endpoint - get "/fetch/actual/gem/:id", :host_name => "localgemserver.test" do + get "/fetch/actual/gem/:id", host_name: "localgemserver.test" do redirect "http://bundler.localgemserver.test#{request.path_info}" end diff --git a/spec/bundler/support/artifice/helpers/endpoint.rb b/spec/bundler/support/artifice/helpers/endpoint.rb index fc0381dc38..6115e91535 100644 --- a/spec/bundler/support/artifice/helpers/endpoint.rb +++ b/spec/bundler/support/artifice/helpers/endpoint.rb @@ -69,10 +69,10 @@ class Endpoint < Sinatra::Base spec = load_spec(name, version, platform, gem_repo) next unless gem_names.include?(spec.name) { - :name => spec.name, - :number => spec.version.version, - :platform => spec.platform.to_s, - :dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep| + name: spec.name, + number: spec.version.version, + platform: spec.platform.to_s, + dependencies: spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep| [dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")] end, } diff --git a/spec/bundler/support/artifice/helpers/rack_request.rb b/spec/bundler/support/artifice/helpers/rack_request.rb index c4a07812a6..45023dfdd6 100644 --- a/spec/bundler/support/artifice/helpers/rack_request.rb +++ b/spec/bundler/support/artifice/helpers/rack_request.rb @@ -56,7 +56,7 @@ module Artifice body_stream_contents = req.body_stream.read if req.body_stream response = rack_request.request("#{prefix}#{req.path}", - { :method => req.method, :input => body || req.body || body_stream_contents }) + { method: req.method, input: body || req.body || body_stream_contents }) make_net_http_response(response, &block) end diff --git a/spec/bundler/support/build_metadata.rb b/spec/bundler/support/build_metadata.rb index 98d8ac23c8..5898e7f3bd 100644 --- a/spec/bundler/support/build_metadata.rb +++ b/spec/bundler/support/build_metadata.rb @@ -10,20 +10,20 @@ module Spec def write_build_metadata(dir: source_root) build_metadata = { - :git_commit_sha => git_commit_sha, - :built_at => loaded_gemspec.date.utc.strftime("%Y-%m-%d"), - :release => true, + git_commit_sha: git_commit_sha, + built_at: loaded_gemspec.date.utc.strftime("%Y-%m-%d"), + release: true, } - replace_build_metadata(build_metadata, dir: dir) # rubocop:disable Style/HashSyntax + replace_build_metadata(build_metadata, dir: dir) end def reset_build_metadata(dir: source_root) build_metadata = { - :release => false, + release: false, } - replace_build_metadata(build_metadata, dir: dir) # rubocop:disable Style/HashSyntax + replace_build_metadata(build_metadata, dir: dir) end private @@ -41,7 +41,7 @@ module Spec end def git_commit_sha - ruby_core_tarball? ? "unknown" : sys_exec("git rev-parse --short HEAD", :dir => source_root).strip + ruby_core_tarball? ? "unknown" : sys_exec("git rev-parse --short HEAD", dir: source_root).strip end extend self diff --git a/spec/bundler/support/builders.rb b/spec/bundler/support/builders.rb index 7b91aaef57..76e05b5203 100644 --- a/spec/bundler/support/builders.rb +++ b/spec/bundler/support/builders.rb @@ -73,11 +73,11 @@ module Spec s.add_dependency "activesupport", ">= 2.0.0" end - build_gem "rspec", "1.2.7", :no_default => true do |s| + build_gem "rspec", "1.2.7", no_default: true do |s| s.write "lib/spec.rb", "SPEC = '1.2.7'" end - build_gem "rack-test", :no_default => true do |s| + build_gem "rack-test", no_default: true do |s| s.write "lib/rack/test.rb", "RACK_TEST = '1.0'" end @@ -258,7 +258,7 @@ module Spec @_build_repo = File.basename(path) yield with_gem_path_as Path.base_system_gem_path do - gem_command :generate_index, :dir => path + gem_command :generate_index, dir: path end ensure @_build_path = nil @@ -521,7 +521,7 @@ module Spec default_branch = options[:default_branch] || "main" path = options[:path] || _default_path source = options[:source] || "git@#{path}" - super(options.merge(:path => path, :source => source)) + super(options.merge(path: path, source: source)) @context.git("config --global init.defaultBranch #{default_branch}", path) @context.git("init", path) @context.git("add *", path) @@ -535,7 +535,7 @@ module Spec class GitBareBuilder < LibBuilder def _build(options) path = options[:path] || _default_path - super(options.merge(:path => path)) + super(options.merge(path: path)) @context.git("init --bare", path) end end @@ -560,7 +560,7 @@ module Spec _default_files.keys.each do |path| _default_files[path] += "\n#{Builders.constantize(name)}_PREV_REF = '#{current_ref}'" end - super(options.merge(:path => libpath, :gemspec => update_gemspec, :source => source)) + super(options.merge(path: libpath, gemspec: update_gemspec, source: source)) @context.git("commit -am BUMP", libpath) end end @@ -583,7 +583,7 @@ module Spec class GemBuilder < LibBuilder def _build(opts) lib_path = opts[:lib_path] || @context.tmp(".tmp/#{@spec.full_name}") - lib_path = super(opts.merge(:path => lib_path, :no_default => opts[:no_default])) + lib_path = super(opts.merge(path: lib_path, no_default: opts[:no_default])) destination = opts[:path] || _default_path FileUtils.mkdir_p(lib_path.join(destination)) @@ -592,16 +592,16 @@ module Spec Bundler.rubygems.build(@spec, opts[:skip_validation]) end elsif opts[:skip_validation] - @context.gem_command "build --force #{@spec.name}", :dir => lib_path + @context.gem_command "build --force #{@spec.name}", dir: lib_path else - @context.gem_command "build #{@spec.name}", :dir => lib_path + @context.gem_command "build #{@spec.name}", dir: lib_path end gem_path = File.expand_path("#{@spec.full_name}.gem", lib_path) if opts[:to_system] - @context.system_gems gem_path, :default => opts[:default] + @context.system_gems gem_path, default: opts[:default] elsif opts[:to_bundle] - @context.system_gems gem_path, :path => @context.default_bundle_path + @context.system_gems gem_path, path: @context.default_bundle_path else FileUtils.mv(gem_path, destination) end diff --git a/spec/bundler/support/filters.rb b/spec/bundler/support/filters.rb index 78545d2e64..8e164af756 100644 --- a/spec/bundler/support/filters.rb +++ b/spec/bundler/support/filters.rb @@ -19,20 +19,20 @@ class RequirementChecker < Proc end RSpec.configure do |config| - config.filter_run_excluding :realworld => true + config.filter_run_excluding realworld: true git_version = Bundler::Source::Git::GitProxy.new(nil, nil).version - config.filter_run_excluding :git => RequirementChecker.against(git_version) - config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0]) - config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION) - config.filter_run_excluding :ruby_repo => !ENV["GEM_COMMAND"].nil? - config.filter_run_excluding :no_color_tty => Gem.win_platform? || !ENV["GITHUB_ACTION"].nil? - config.filter_run_excluding :permissions => Gem.win_platform? - config.filter_run_excluding :readline => Gem.win_platform? - config.filter_run_excluding :jruby_only => RUBY_ENGINE != "jruby" - config.filter_run_excluding :truffleruby_only => RUBY_ENGINE != "truffleruby" - config.filter_run_excluding :man => Gem.win_platform? + config.filter_run_excluding git: RequirementChecker.against(git_version) + config.filter_run_excluding bundler: RequirementChecker.against(Bundler::VERSION.split(".")[0]) + config.filter_run_excluding rubygems: RequirementChecker.against(Gem::VERSION) + config.filter_run_excluding ruby_repo: !ENV["GEM_COMMAND"].nil? + config.filter_run_excluding no_color_tty: Gem.win_platform? || !ENV["GITHUB_ACTION"].nil? + config.filter_run_excluding permissions: Gem.win_platform? + config.filter_run_excluding readline: Gem.win_platform? + config.filter_run_excluding jruby_only: RUBY_ENGINE != "jruby" + config.filter_run_excluding truffleruby_only: RUBY_ENGINE != "truffleruby" + config.filter_run_excluding man: Gem.win_platform? config.filter_run_when_matching :focus unless ENV["CI"] end diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index f873220f14..31b4f64d63 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -116,9 +116,9 @@ module Spec end end.join - ruby_cmd = build_ruby_cmd({ :load_path => load_path, :requires => requires }) + ruby_cmd = build_ruby_cmd({ load_path: load_path, requires: requires }) cmd = "#{ruby_cmd} #{bundle_bin} #{cmd}#{args}" - sys_exec(cmd, { :env => env, :dir => dir, :raise_on_error => raise_on_error }, &block) + sys_exec(cmd, { env: env, dir: dir, raise_on_error: raise_on_error }, &block) end def bundler(cmd, options = {}) @@ -170,7 +170,7 @@ module Spec end def git(cmd, path, options = {}) - sys_exec("git #{cmd}", options.merge(:dir => path)) + sys_exec("git #{cmd}", options.merge(dir: path)) end def sys_exec(cmd, options = {}) @@ -181,7 +181,7 @@ module Spec require "open3" require "shellwords" - Open3.popen3(env, *cmd.shellsplit, :chdir => dir) do |stdin, stdout, stderr, wait_thr| + Open3.popen3(env, *cmd.shellsplit, chdir: dir) do |stdin, stdout, stderr, wait_thr| yield stdin, stdout, wait_thr if block_given? stdin.close @@ -333,14 +333,14 @@ module Spec target_shipped_file = build_path + shipped_file target_shipped_dir = File.dirname(target_shipped_file) FileUtils.mkdir_p target_shipped_dir unless File.directory?(target_shipped_dir) - FileUtils.cp shipped_file, target_shipped_file, :preserve => true + FileUtils.cp shipped_file, target_shipped_file, preserve: true end - replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax + replace_version_file(version, dir: build_path) - Spec::BuildMetadata.write_build_metadata(dir: build_path) # rubocop:disable Style/HashSyntax + Spec::BuildMetadata.write_build_metadata(dir: build_path) - gem_command "build #{relative_gemspec}", :dir => build_path + gem_command "build #{relative_gemspec}", dir: build_path yield(bundler_path) ensure @@ -489,7 +489,7 @@ module Spec end def revision_for(path) - sys_exec("git rev-parse HEAD", :dir => path).strip + sys_exec("git rev-parse HEAD", dir: path).strip end def with_read_only(pattern) diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb index 5d9ea19343..086a311551 100644 --- a/spec/bundler/support/indexes.rb +++ b/spec/bundler/support/indexes.rb @@ -16,8 +16,8 @@ module Spec def resolve(args = [], dependency_api_available: true) @platforms ||= ["ruby"] - default_source = instance_double("Bundler::Source::Rubygems", :specs => @index, :to_s => "locally install gems", :dependency_api_available? => dependency_api_available) - source_requirements = { :default => default_source } + default_source = instance_double("Bundler::Source::Rubygems", specs: @index, to_s: "locally install gems", dependency_api_available?: dependency_api_available) + source_requirements = { default: default_source } base = args[0] || Bundler::SpecSet.new([]) base.each {|ls| ls.source = default_source } gem_version_promoter = args[1] || Bundler::GemVersionPromoter.new @@ -27,7 +27,7 @@ module Spec name = d.name source_requirements[name] = d.source = default_source end - packages = Bundler::Resolver::Base.new(source_requirements, @deps, base, @platforms, :locked_specs => originally_locked, :unlock => unlock) + packages = Bundler::Resolver::Base.new(source_requirements, @deps, base, @platforms, locked_specs: originally_locked, unlock: unlock) Bundler::Resolver.new(packages, gem_version_promoter).start end @@ -42,7 +42,7 @@ module Spec end def should_resolve_without_dependency_api(specs) - got = resolve(:dependency_api_available => false) + got = resolve(dependency_api_available: false) got = got.map(&:full_name).sort expect(got).to eq(specs.sort) end diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 23b8cc4180..e90fdf8d56 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -264,7 +264,7 @@ module Spec def git_ls_files(glob) skip "Not running on a git context, since running tests from a tarball" if ruby_core_tarball? - sys_exec("git ls-files -z -- #{glob}", :dir => source_root).split("\x0") + sys_exec("git ls-files -z -- #{glob}", dir: source_root).split("\x0") end def tracked_files_glob diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb index 3289d5e8e2..526e1c09a9 100644 --- a/spec/bundler/support/platforms.rb +++ b/spec/bundler/support/platforms.rb @@ -100,7 +100,7 @@ module Spec end def lockfile_platforms(*extra, defaults: default_locked_platforms) - platforms = default_platform_list(*extra, :defaults => defaults) + platforms = default_platform_list(*extra, defaults: defaults) platforms.map(&:to_s).sort.join("\n ") end diff --git a/spec/bundler/support/rubygems_version_manager.rb b/spec/bundler/support/rubygems_version_manager.rb index cb670d60e5..88da14b67e 100644 --- a/spec/bundler/support/rubygems_version_manager.rb +++ b/spec/bundler/support/rubygems_version_manager.rb @@ -65,7 +65,7 @@ class RubygemsVersionManager def switch_local_copy_if_needed return unless local_copy_switch_needed? - sys_exec("git checkout #{target_tag}", :dir => local_copy_path) + sys_exec("git checkout #{target_tag}", dir: local_copy_path) ENV["RGV"] = local_copy_path.to_s end @@ -84,7 +84,7 @@ class RubygemsVersionManager end def local_copy_tag - sys_exec("git rev-parse --abbrev-ref HEAD", :dir => local_copy_path) + sys_exec("git rev-parse --abbrev-ref HEAD", dir: local_copy_path) end def local_copy_path @@ -97,7 +97,7 @@ class RubygemsVersionManager rubygems_path = source_root.join("tmp/rubygems") unless rubygems_path.directory? - sys_exec("git clone .. #{rubygems_path}", :dir => source_root) + sys_exec("git clone .. #{rubygems_path}", dir: source_root) end rubygems_path diff --git a/spec/bundler/update/gemfile_spec.rb b/spec/bundler/update/gemfile_spec.rb index 1c5294101e..d32a7945b0 100644 --- a/spec/bundler/update/gemfile_spec.rb +++ b/spec/bundler/update/gemfile_spec.rb @@ -8,8 +8,8 @@ RSpec.describe "bundle update" do gem 'rack' G - bundle :install, :gemfile => bundled_app("NotGemfile") - bundle :update, :gemfile => bundled_app("NotGemfile"), :all => true + bundle :install, gemfile: bundled_app("NotGemfile") + bundle :update, gemfile: bundled_app("NotGemfile"), all: true # Specify BUNDLE_GEMFILE for `the_bundle` # to retrieve the proper Gemfile @@ -30,7 +30,7 @@ RSpec.describe "bundle update" do end it "uses the gemfile to update" do - bundle "update", :all => true + bundle "update", all: true bundle "list" expect(out).to include("rack (1.0.0)") @@ -38,8 +38,8 @@ RSpec.describe "bundle update" do it "uses the gemfile while in a subdirectory" do bundled_app("subdir").mkpath - bundle "update", :all => true, :dir => bundled_app("subdir") - bundle "list", :dir => bundled_app("subdir") + bundle "update", all: true, dir: bundled_app("subdir") + bundle "list", dir: bundled_app("subdir") expect(out).to include("rack (1.0.0)") end diff --git a/spec/bundler/update/gems/fund_spec.rb b/spec/bundler/update/gems/fund_spec.rb index d80f4018f3..4a87c16bf7 100644 --- a/spec/bundler/update/gems/fund_spec.rb +++ b/spec/bundler/update/gems/fund_spec.rb @@ -40,7 +40,7 @@ RSpec.describe "bundle update" do gem 'has_funding' G - bundle :update, :all => true + bundle :update, all: true end it "displays fund message" do diff --git a/spec/bundler/update/gems/post_install_spec.rb b/spec/bundler/update/gems/post_install_spec.rb index 3aaa659d57..e3593387d4 100644 --- a/spec/bundler/update/gems/post_install_spec.rb +++ b/spec/bundler/update/gems/post_install_spec.rb @@ -52,7 +52,7 @@ RSpec.describe "bundle update" do gem 'thin' G - bundle :update, :all => true + bundle :update, all: true end it_behaves_like "a post-install message outputter" @@ -67,7 +67,7 @@ RSpec.describe "bundle update" do gem 'thin' G - bundle :update, :all => true + bundle :update, all: true end it_behaves_like "a post-install message outputter" diff --git a/spec/bundler/update/git_spec.rb b/spec/bundler/update/git_spec.rb index bfc72b3546..3b7bbfd979 100644 --- a/spec/bundler/update/git_spec.rb +++ b/spec/bundler/update/git_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle update" do describe "git sources" do it "floats on a branch when :branch is used" do build_git "foo", "1.0" - update_git "foo", :branch => "omg" + update_git "foo", branch: "omg" install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -17,14 +17,14 @@ RSpec.describe "bundle update" do s.write "lib/foo.rb", "FOO = '1.1'" end - bundle "update", :all => true + bundle "update", all: true expect(the_bundle).to include_gems "foo 1.1" end it "updates correctly when you have like craziness" do - build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport") - build_git "rails", "3.0", :path => lib_path("rails") do |s| + build_lib "activesupport", "3.0", path: lib_path("rails/activesupport") + build_git "rails", "3.0", path: lib_path("rails") do |s| s.add_dependency "activesupport", "= 3.0" end @@ -38,8 +38,8 @@ RSpec.describe "bundle update" do end it "floats on a branch when :branch is used and the source is specified in the update" do - build_git "foo", "1.0", :path => lib_path("foo") - update_git "foo", :branch => "omg", :path => lib_path("foo") + build_git "foo", "1.0", path: lib_path("foo") + update_git "foo", branch: "omg", path: lib_path("foo") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -48,7 +48,7 @@ RSpec.describe "bundle update" do end G - update_git "foo", :path => lib_path("foo") do |s| + update_git "foo", path: lib_path("foo") do |s| s.write "lib/foo.rb", "FOO = '1.1'" end @@ -58,8 +58,8 @@ RSpec.describe "bundle update" do end it "floats on main when updating all gems that are pinned to the source even if you have child dependencies" do - build_git "foo", :path => lib_path("foo") - build_gem "bar", :to_bundle => true do |s| + build_git "foo", path: lib_path("foo") + build_gem "bar", to_bundle: true do |s| s.add_dependency "foo" end @@ -69,7 +69,7 @@ RSpec.describe "bundle update" do gem "bar" G - update_git "foo", :path => lib_path("foo") do |s| + update_git "foo", path: lib_path("foo") do |s| s.write "lib/foo.rb", "FOO = '1.1'" end @@ -79,8 +79,8 @@ RSpec.describe "bundle update" do end it "notices when you change the repo url in the Gemfile" do - build_git "foo", :path => lib_path("foo_one") - build_git "foo", :path => lib_path("foo_two") + build_git "foo", path: lib_path("foo_one") + build_git "foo", path: lib_path("foo_two") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -101,9 +101,9 @@ RSpec.describe "bundle update" do it "fetches tags from the remote" do build_git "foo" - @remote = build_git("bar", :bare => true) - update_git "foo", :remote => file_uri_for(@remote.path) - update_git "foo", :push => "main" + @remote = build_git("bar", bare: true) + update_git "foo", remote: file_uri_for(@remote.path) + update_git "foo", push: "main" install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" @@ -111,15 +111,15 @@ RSpec.describe "bundle update" do G # Create a new tag on the remote that needs fetching - update_git "foo", :tag => "fubar" - update_git "foo", :push => "fubar" + update_git "foo", tag: "fubar" + update_git "foo", push: "fubar" gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem 'foo', :git => "#{@remote.path}", :tag => "fubar" G - bundle "update", :all => true + bundle "update", all: true expect(err).to be_empty end @@ -142,8 +142,8 @@ RSpec.describe "bundle update" do s.add_dependency "submodule" end - sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0") - sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0") + sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", dir: lib_path("has_submodule-1.0") + sys_exec "git commit -m \"submodulator\"", dir: lib_path("has_submodule-1.0") end it "it unlocks the source when submodules are added to a git source" do @@ -168,7 +168,7 @@ RSpec.describe "bundle update" do expect(out).to eq("GIT") end - it "unlocks the source when submodules are removed from git source", :git => ">= 2.9.0" do + it "unlocks the source when submodules are removed from git source", git: ">= 2.9.0" do install_gemfile <<-G source "#{file_uri_for(gem_repo4)}" git "#{lib_path("has_submodule-1.0")}", :submodules => true do @@ -201,7 +201,7 @@ RSpec.describe "bundle update" do lib_path("foo-1.0").join(".git").rmtree - bundle :update, :all => true, :raise_on_error => false + bundle :update, all: true, raise_on_error: false expect(err).to include(lib_path("foo-1.0").to_s). and match(/Git error: command `git fetch.+has failed/) end @@ -209,7 +209,7 @@ RSpec.describe "bundle update" do it "should not explode on invalid revision on update of gem by name" do build_git "rack", "0.8" - build_git "rack", "0.8", :path => lib_path("local-rack") do |s| + build_git "rack", "0.8", path: lib_path("local-rack") do |s| s.write "lib/rack.rb", "puts :LOCAL" end @@ -224,16 +224,16 @@ RSpec.describe "bundle update" do end it "shows the previous version of the gem" do - build_git "rails", "2.3.2", :path => lib_path("rails") + build_git "rails", "2.3.2", path: lib_path("rails") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails", :git => "#{file_uri_for(lib_path("rails"))}" G - update_git "rails", "3.0", :path => lib_path("rails"), :gemspec => true + update_git "rails", "3.0", path: lib_path("rails"), gemspec: true - bundle "update", :all => true + bundle "update", all: true expect(out).to include("Using rails 3.0 (was 2.3.2) from #{file_uri_for(lib_path("rails"))} (at main@#{revision_for(lib_path("rails"))[0..6]})") end end @@ -241,7 +241,7 @@ RSpec.describe "bundle update" do describe "with --source flag" do before :each do build_repo2 - @git = build_git "foo", :path => lib_path("foo") do |s| + @git = build_git "foo", path: lib_path("foo") do |s| s.executables = "foobar" end @@ -255,7 +255,7 @@ RSpec.describe "bundle update" do end it "updates the source" do - update_git "foo", :path => @git.path + update_git "foo", path: @git.path bundle "update --source foo" @@ -268,7 +268,7 @@ RSpec.describe "bundle update" do end it "unlocks gems that were originally pulled in by the source" do - update_git "foo", "2.0", :path => @git.path + update_git "foo", "2.0", path: @git.path bundle "update --source foo" expect(the_bundle).to include_gems "foo 2.0" @@ -276,7 +276,7 @@ RSpec.describe "bundle update" do it "leaves all other gems frozen" do update_repo2 - update_git "foo", :path => @git.path + update_git "foo", path: @git.path bundle "update --source foo" expect(the_bundle).to include_gems "rack 1.0" @@ -286,7 +286,7 @@ RSpec.describe "bundle update" do context "when the gem and the repository have different names" do before :each do build_repo2 - @git = build_git "foo", :path => lib_path("bar") + @git = build_git "foo", path: lib_path("bar") install_gemfile <<-G source "#{file_uri_for(gem_repo2)}" @@ -301,7 +301,7 @@ RSpec.describe "bundle update" do spec_lines = lib_path("bar/foo.gemspec").read.split("\n") spec_lines[5] = "s.version = '2.0'" - update_git "foo", "2.0", :path => @git.path do |s| + update_git "foo", "2.0", path: @git.path do |s| s.write "foo.gemspec", spec_lines.join("\n") end diff --git a/spec/bundler/update/path_spec.rb b/spec/bundler/update/path_spec.rb index 756770313b..1f8992b33f 100644 --- a/spec/bundler/update/path_spec.rb +++ b/spec/bundler/update/path_spec.rb @@ -3,14 +3,14 @@ RSpec.describe "path sources" do describe "bundle update --source" do it "shows the previous version of the gem when updated from path source" do - build_lib "activesupport", "2.3.5", :path => lib_path("rails/activesupport") + build_lib "activesupport", "2.3.5", path: lib_path("rails/activesupport") install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "activesupport", :path => "#{lib_path("rails/activesupport")}" G - build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport") + build_lib "activesupport", "3.0", path: lib_path("rails/activesupport") bundle "update --source activesupport" expect(out).to include("Using activesupport 3.0 (was 2.3.5) from source at `#{lib_path("rails/activesupport")}`") diff --git a/spec/bundler/update/redownload_spec.rb b/spec/bundler/update/redownload_spec.rb index b55593d077..4a8c711bfa 100644 --- a/spec/bundler/update/redownload_spec.rb +++ b/spec/bundler/update/redownload_spec.rb @@ -9,12 +9,12 @@ RSpec.describe "bundle update" do end describe "with --force" do - it "shows a deprecation when single flag passed", :bundler => 2 do + it "shows a deprecation when single flag passed", bundler: 2 do bundle "update rack --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end - it "shows a deprecation when multiple flags passed", :bundler => 2 do + it "shows a deprecation when multiple flags passed", bundler: 2 do bundle "update rack --no-color --force" expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`" end @@ -34,7 +34,7 @@ RSpec.describe "bundle update" do it "re-installs installed gems" do rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb") rack_lib.open("w") {|f| f.write("blah blah blah") } - bundle :update, :redownload => true + bundle :update, redownload: true expect(out).to include "Installing rack 1.0.0" expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n") |