diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-06-30 12:27:03 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-07-24 14:59:34 +0900 |
commit | 0e7536bf490cf4b26cf075810e918a5840dbb08b (patch) | |
tree | a9b2f3d0b829116c07615337510bb14b747b901e /spec | |
parent | 5a43b0ddd5617ba611db9d2ab1dd7e8054a2c536 (diff) | |
download | ruby-0e7536bf490cf4b26cf075810e918a5840dbb08b.tar.gz |
[rubygems/rubygems] Prefer squiggly heredocs over custom helper
https://github.com/rubygems/rubygems/commit/258476c38a
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/bundler/bundler_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/env_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/lockfile_parser_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/plugin/api/source_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/bundler/settings/validator_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/bundler/yaml_serializer_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/commands/doctor_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/exec_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 12 | ||||
-rw-r--r-- | spec/bundler/commands/viz_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/install/allow_offline_install_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/deploy_spec.rb | 14 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/gemspec_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/sources_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gems/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gems/resolving_spec.rb | 8 | ||||
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 4 |
17 files changed, 51 insertions, 51 deletions
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb index 54c12dbf3d..f4c1664620 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Bundler do context "with incorrect YAML file" do before do File.open(app_gemspec_path, "wb") do |f| - f.write strip_whitespace(<<-GEMSPEC) + f.write <<~GEMSPEC --- {:!00 ao=gu\g1= 7~f GEMSPEC @@ -147,7 +147,7 @@ RSpec.describe Bundler do context "with gemspec containing local variables" do before do File.open(app_gemspec_path, "wb") do |f| - f.write strip_whitespace(<<-GEMSPEC) + f.write <<~GEMSPEC must_not_leak = true Gem::Specification.new do |gem| gem.name = "leak check" diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb index a00489d0e5..0fdcb560b7 100644 --- a/spec/bundler/bundler/env_spec.rb +++ b/spec/bundler/bundler/env_spec.rb @@ -139,7 +139,7 @@ RSpec.describe Bundler::Env do context "when Gemfile contains a gemspec and print_gemspecs is true" do let(:gemspec) do - strip_whitespace(<<-GEMSPEC) + <<~GEMSPEC Gem::Specification.new do |gem| gem.name = "foo" gem.author = "Fumofu" @@ -178,7 +178,7 @@ RSpec.describe Bundler::Env do allow(Bundler::SharedHelpers).to receive(:pwd).and_return(bundled_app) output = described_class.report(:print_gemspecs => true) - expect(output).to include(strip_whitespace(<<-ENV)) + expect(output).to include(<<~ENV) ## Gemfile ### Gemfile diff --git a/spec/bundler/bundler/lockfile_parser_spec.rb b/spec/bundler/bundler/lockfile_parser_spec.rb index 3a6d61336f..30fbeac71a 100644 --- a/spec/bundler/bundler/lockfile_parser_spec.rb +++ b/spec/bundler/bundler/lockfile_parser_spec.rb @@ -3,7 +3,7 @@ require "bundler/lockfile_parser" RSpec.describe Bundler::LockfileParser do - let(:lockfile_contents) { strip_whitespace(<<-L) } + let(:lockfile_contents) { <<~L } GIT remote: https://github.com/alloy/peiji-san.git revision: eca485d8dc95f12aaec1a434b49d295c7e91844b @@ -39,7 +39,7 @@ RSpec.describe Bundler::LockfileParser do end describe ".unknown_sections_in_lockfile" do - let(:lockfile_contents) { strip_whitespace(<<-L) } + let(:lockfile_contents) { <<~L } UNKNOWN ATTR UNKNOWN ATTR 2 diff --git a/spec/bundler/bundler/plugin/api/source_spec.rb b/spec/bundler/bundler/plugin/api/source_spec.rb index 428ceb220a..ae02e08bea 100644 --- a/spec/bundler/bundler/plugin/api/source_spec.rb +++ b/spec/bundler/bundler/plugin/api/source_spec.rb @@ -51,7 +51,7 @@ RSpec.describe Bundler::Plugin::API::Source do context "to_lock" do it "returns the string with remote and type" do - expected = strip_whitespace <<-L + expected = <<~L PLUGIN SOURCE remote: #{uri} type: #{type} @@ -67,7 +67,7 @@ RSpec.describe Bundler::Plugin::API::Source do end it "includes them" do - expected = strip_whitespace <<-L + expected = <<~L PLUGIN SOURCE remote: #{uri} type: #{type} diff --git a/spec/bundler/bundler/settings/validator_spec.rb b/spec/bundler/bundler/settings/validator_spec.rb index e4ffd89435..b252ba59a0 100644 --- a/spec/bundler/bundler/settings/validator_spec.rb +++ b/spec/bundler/bundler/settings/validator_spec.rb @@ -44,14 +44,14 @@ RSpec.describe Bundler::Settings::Validator do validate!("without", "b:c", "BUNDLE_WITH" => "a") end.not_to raise_error - expect { validate!("with", "b:c", "BUNDLE_WITHOUT" => "c:d") }.to raise_error Bundler::InvalidOption, strip_whitespace(<<-EOS).strip + expect { validate!("with", "b:c", "BUNDLE_WITHOUT" => "c:d") }.to raise_error Bundler::InvalidOption, <<~EOS.strip Setting `with` to "b:c" failed: - a group cannot be in both `with` & `without` simultaneously - `without` is current set to [:c, :d] - the `c` groups conflict EOS - expect { validate!("without", "b:c", "BUNDLE_WITH" => "c:d") }.to raise_error Bundler::InvalidOption, strip_whitespace(<<-EOS).strip + expect { validate!("without", "b:c", "BUNDLE_WITH" => "c:d") }.to raise_error Bundler::InvalidOption, <<~EOS.strip Setting `without` to "b:c" failed: - a group cannot be in both `with` & `without` simultaneously - `with` is current set to [:c, :d] @@ -74,7 +74,7 @@ RSpec.describe Bundler::Settings::Validator do describe "#fail!" do it "raises with a helpful message" do - expect { subject.fail!("key", "value", "reason1", "reason2") }.to raise_error Bundler::InvalidOption, strip_whitespace(<<-EOS).strip + expect { subject.fail!("key", "value", "reason1", "reason2") }.to raise_error Bundler::InvalidOption, <<~EOS.strip Setting `key` to "value" failed: - rule description - reason1 diff --git a/spec/bundler/bundler/yaml_serializer_spec.rb b/spec/bundler/bundler/yaml_serializer_spec.rb index 1241c74bbf..da4aa52829 100644 --- a/spec/bundler/bundler/yaml_serializer_spec.rb +++ b/spec/bundler/bundler/yaml_serializer_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Bundler::YAMLSerializer do it "works for simple hash" do hash = { "Q" => "Where does Thursday come before Wednesday? In the dictionary. :P" } - expected = strip_whitespace <<-YAML + expected = <<~YAML --- Q: "Where does Thursday come before Wednesday? In the dictionary. :P" YAML @@ -24,7 +24,7 @@ RSpec.describe Bundler::YAMLSerializer do }, } - expected = strip_whitespace <<-YAML + expected = <<~YAML --- nice-one: read_ahead: "All generalizations are false, including this one" @@ -45,7 +45,7 @@ RSpec.describe Bundler::YAMLSerializer do }, } - expected = strip_whitespace <<-YAML + expected = <<~YAML --- nested_hash: contains_array: @@ -61,7 +61,7 @@ RSpec.describe Bundler::YAMLSerializer do describe "#load" do it "works for simple hash" do - yaml = strip_whitespace <<-YAML + yaml = <<~YAML --- Jon: "Air is free dude!" Jack: "Yes.. until you buy a bag of chips!" @@ -76,7 +76,7 @@ RSpec.describe Bundler::YAMLSerializer do end it "works for nested hash" do - yaml = strip_whitespace <<-YAML + yaml = <<~YAML --- baa: baa: "black sheep" @@ -98,7 +98,7 @@ RSpec.describe Bundler::YAMLSerializer do end it "handles colon in key/value" do - yaml = strip_whitespace <<-YAML + yaml = <<~YAML BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/: http://rubygems-mirror.org YAML @@ -106,7 +106,7 @@ RSpec.describe Bundler::YAMLSerializer do end it "handles arrays inside hashes" do - yaml = strip_whitespace <<-YAML + yaml = <<~YAML --- nested_hash: contains_array: @@ -127,7 +127,7 @@ RSpec.describe Bundler::YAMLSerializer do end it "handles windows-style CRLF line endings" do - yaml = strip_whitespace(<<-YAML).gsub("\n", "\r\n") + yaml = <<~YAML.gsub("\n", "\r\n") --- nested_hash: contains_array: diff --git a/spec/bundler/commands/doctor_spec.rb b/spec/bundler/commands/doctor_spec.rb index 1afac00923..13aaf2670c 100644 --- a/spec/bundler/commands/doctor_spec.rb +++ b/spec/bundler/commands/doctor_spec.rb @@ -59,7 +59,7 @@ RSpec.describe "bundle doctor" do expect(doctor).to receive(:bundles_for_gem).exactly(2).times.and_return ["/path/to/rack/rack.bundle"] expect(doctor).to receive(:dylibs).exactly(2).times.and_return ["/usr/local/opt/icu4c/lib/libicui18n.57.1.dylib"] allow(Fiddle).to receive(:dlopen).with("/usr/local/opt/icu4c/lib/libicui18n.57.1.dylib").and_raise(Fiddle::DLError) - expect { doctor.run }.to raise_error(Bundler::ProductionError, strip_whitespace(<<-E).strip), @stdout.string + expect { doctor.run }.to raise_error(Bundler::ProductionError, <<~E.strip), @stdout.string The following gems are missing OS dependencies: * bundler: /usr/local/opt/icu4c/lib/libicui18n.57.1.dylib * rack: /usr/local/opt/icu4c/lib/libicui18n.57.1.dylib diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 95db25b358..7217c9d61f 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -1024,7 +1024,7 @@ __FILE__: #{path.to_s.inspect} end context "signals being trapped by bundler" do - let(:executable) { strip_whitespace <<-RUBY } + let(:executable) { <<~RUBY } #{shebang} begin Thread.new do @@ -1051,7 +1051,7 @@ __FILE__: #{path.to_s.inspect} end context "signals not being trapped by bunder" do - let(:executable) { strip_whitespace <<-RUBY } + let(:executable) { <<~RUBY } #{shebang} signals = #{test_signals.inspect} diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index ede1ff6b8e..e06c8c8dd3 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -651,7 +651,7 @@ RSpec.describe "bundle gem" do system_gems ["rake-13.0.1"] - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE task :default do puts 'SUCCESS' end @@ -797,7 +797,7 @@ RSpec.describe "bundle gem" do end it "creates a default rake task to run the test suite" do - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE # frozen_string_literal: true require "bundler/gem_tasks" @@ -855,7 +855,7 @@ RSpec.describe "bundle gem" do end it "creates a default rake task to run the test suite" do - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE # frozen_string_literal: true require "bundler/gem_tasks" @@ -1419,7 +1419,7 @@ RSpec.describe "bundle gem" do end it "depends on compile task for build" do - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE # frozen_string_literal: true require "bundler/gem_tasks" @@ -1477,7 +1477,7 @@ RSpec.describe "bundle gem" do end it "depends on compile task for build" do - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE # frozen_string_literal: true require "bundler/gem_tasks" @@ -1583,7 +1583,7 @@ Usage: "bundle gem NAME [OPTIONS]" end expect(bundled_app("foobar/spec/spec_helper.rb")).to exist - rakefile = strip_whitespace <<-RAKEFILE + rakefile = <<~RAKEFILE # frozen_string_literal: true require "bundler/gem_tasks" diff --git a/spec/bundler/commands/viz_spec.rb b/spec/bundler/commands/viz_spec.rb index cf612397ab..b25683bfb3 100644 --- a/spec/bundler/commands/viz_spec.rb +++ b/spec/bundler/commands/viz_spec.rb @@ -16,7 +16,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re expect(out).to include("gem_graph.png") bundle "viz", :format => "debug" - expect(out).to eq(strip_whitespace(<<-DOT).strip) + expect(out).to eq(<<~DOT.strip) digraph Gemfile { concentrate = "true"; normalize = "true"; @@ -50,7 +50,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re expect(out).to include("gem_graph.png") bundle "viz", :format => :debug, :version => true - expect(out).to eq(strip_whitespace(<<-EOS).strip) + expect(out).to eq(<<~EOS.strip) digraph Gemfile { concentrate = "true"; normalize = "true"; @@ -88,7 +88,7 @@ RSpec.describe "bundle viz", :bundler => "< 3", :if => Bundler.which("dot"), :re G bundle "viz", :format => "debug" - expect(out).to eq(strip_whitespace(<<-DOT).strip) + expect(out).to eq(<<~DOT.strip) digraph Gemfile { concentrate = "true"; normalize = "true"; diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb index 4c6c77a61e..75c7aa9085 100644 --- a/spec/bundler/install/allow_offline_install_spec.rb +++ b/spec/bundler/install/allow_offline_install_spec.rb @@ -51,7 +51,7 @@ RSpec.describe "bundle install with :allow_offline_install" do def break_git_remote_ops! FileUtils.mkdir_p(tmp("broken_path")) File.open(tmp("broken_path/git"), "w", 0o755) do |f| - f.puts strip_whitespace(<<-RUBY) + f.puts <<~RUBY #!/usr/bin/env ruby fetch_args = %w(fetch --force --quiet) clone_args = %w(clone --bare --no-hardlinks --quiet) diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 2a88ed5b06..045d643a8f 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -506,15 +506,15 @@ RSpec.describe "install in deployment or frozen mode" do G run "require 'rack'", :raise_on_error => false - expect(err).to include strip_whitespace(<<-E).strip -The dependencies in your gemfile changed, but the lockfile can't be updated because frozen mode is set (Bundler::ProductionError) + 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) -You have added to the Gemfile: -* rack (= 1.0.0) -* rack-obama + You have added to the Gemfile: + * rack (= 1.0.0) + * rack-obama -You have deleted from the Gemfile: -* rack + You have deleted from the Gemfile: + * rack E end end diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index 73f04f071d..346120446d 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -448,7 +448,7 @@ RSpec.describe "bundle install from an existing gemspec" do context "as a runtime dependency" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY" - expect(lockfile).to eq strip_whitespace(<<-L) + expect(lockfile).to eq <<~L PATH remote: . specs: @@ -481,7 +481,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY" - expect(lockfile).to eq strip_whitespace(<<-L) + expect(lockfile).to eq <<~L PATH remote: . specs: @@ -515,7 +515,7 @@ RSpec.describe "bundle install from an existing gemspec" do it "keeps all platform dependencies in the lockfile" do expect(the_bundle).to include_gems "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY" - expect(lockfile).to eq strip_whitespace(<<-L) + expect(lockfile).to eq <<~L PATH remote: . specs: diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index 562fa6c5b4..9095eca03b 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -1374,7 +1374,7 @@ RSpec.describe "bundle install with gems on multiple sources" do gem "thin" end G - expect(err).to eq strip_whitespace(<<-EOS).strip + expect(err).to eq <<~EOS.strip Warning: The gem 'rack' was found in multiple relevant sources. * rubygems repository https://gem.repo1/ * rubygems repository https://gem.repo4/ @@ -1404,7 +1404,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end G expect(last_command).to be_failure - expect(err).to eq strip_whitespace(<<-EOS).strip + expect(err).to eq <<~EOS.strip The gem 'rack' was found in multiple relevant sources. * rubygems repository https://gem.repo1/ * rubygems repository https://gem.repo4/ diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 8ab8e61673..f0717de36d 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -289,7 +289,7 @@ The checksum of /versions does not match the checksum provided by the server! So 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"] = strip_whitespace(<<-EOS).strip + ENV["BUNDLER_SPEC_ALL_REQUESTS"] = <<~EOS.strip #{source_uri}/versions #{source_uri}/info/rack EOS diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb index fb6dda2f88..acaadea632 100644 --- a/spec/bundler/install/gems/resolving_spec.rb +++ b/spec/bundler/install/gems/resolving_spec.rb @@ -415,7 +415,7 @@ RSpec.describe "bundle install with install-time dependencies" do bundle "install", :raise_on_error => false end - nice_error = strip_whitespace(<<-E).strip + nice_error = <<~E.strip Could not find gem 'sorbet-static (= 0.5.10554)' with platforms 'arm64-darwin-21', 'aarch64-linux' in rubygems repository #{file_uri_for(gem_repo4)}/ or installed locally. The source contains the following gems matching 'sorbet-static (= 0.5.10554)': @@ -521,7 +521,7 @@ RSpec.describe "bundle install with install-time dependencies" do expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000") - nice_error = strip_whitespace(<<-E).strip + nice_error = <<~E.strip Could not find compatible versions Because every version of require_ruby depends on Ruby > 9000 @@ -543,7 +543,7 @@ RSpec.describe "bundle install with install-time dependencies" do expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000") - nice_error = strip_whitespace(<<-E).strip + nice_error = <<~E.strip Could not find compatible versions Because every version of require_ruby depends on Ruby > 9000 @@ -587,7 +587,7 @@ RSpec.describe "bundle install with install-time dependencies" do G expect(err).to_not include("Gem::InstallError: require_rubygems requires RubyGems version > 9000") - nice_error = strip_whitespace(<<-E).strip + nice_error = <<~E.strip Because every version of require_rubygems depends on RubyGems > 9000 and Gemfile depends on require_rubygems >= 0, RubyGems > 9000 is required. diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 0321e168ca..713cab2124 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -1316,7 +1316,7 @@ end exempts end - let(:activation_warning_hack) { strip_whitespace(<<-RUBY) } + let(:activation_warning_hack) { <<~RUBY } require #{spec_dir.join("support/hax").to_s.dump} Gem::Specification.send(:alias_method, :bundler_spec_activate, :activate) @@ -1336,7 +1336,7 @@ end "-r#{bundled_app("activation_warning_hack.rb")} #{ENV["RUBYOPT"]}" end - let(:code) { strip_whitespace(<<-RUBY) } + let(:code) { <<~RUBY } require "pp" loaded_specs = Gem.loaded_specs.dup #{exemptions.inspect}.each {|s| loaded_specs.delete(s) } |