diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-01-15 20:59:40 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-01-16 19:41:11 +0900 |
| commit | 10e7e92badce82f25118b6c0673ea7b3ce97e54d (patch) | |
| tree | 2e8709426168b2c92aa8f008913583545e761af6 | |
| parent | 3638f67069e8186258445a66317660ecf64dc932 (diff) | |
[rubygems/rubygems] Extract logic to manipulate RUBYLIB in specs to a helper
https://github.com/rubygems/rubygems/commit/0057382bb1
| -rw-r--r-- | spec/bundler/bundler/shared_helpers_spec.rb | 9 | ||||
| -rw-r--r-- | spec/bundler/commands/install_spec.rb | 3 | ||||
| -rw-r--r-- | spec/bundler/support/env.rb | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb index d2385d2e58..6db8cd6783 100644 --- a/spec/bundler/bundler/shared_helpers_spec.rb +++ b/spec/bundler/bundler/shared_helpers_spec.rb @@ -258,8 +258,7 @@ RSpec.describe Bundler::SharedHelpers do it "ensures bundler's ruby version lib path is in ENV['RUBYLIB']" do subject.set_bundle_environment - paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) - expect(paths).to include(ruby_lib_path) + expect(rubylib).to include(ruby_lib_path) end end @@ -276,8 +275,7 @@ RSpec.describe Bundler::SharedHelpers do subject.set_bundle_environment - paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) - expect(paths.count(RbConfig::CONFIG["rubylibdir"])).to eq(0) + expect(rubylib.count(RbConfig::CONFIG["rubylibdir"])).to eq(0) end it "exits if bundle path contains the unix-like path separator" do @@ -441,8 +439,7 @@ RSpec.describe Bundler::SharedHelpers do it "ENV['RUBYLIB'] should only contain one instance of bundler's ruby version lib path" do subject.set_bundle_environment - paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) - expect(paths.count(ruby_lib_path)).to eq(1) + expect(rubylib.count(ruby_lib_path)).to eq(1) end end end diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 1c99a1877a..992777722c 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -238,8 +238,7 @@ RSpec.describe "bundle install with gem sources" do it "loads env plugins" 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.unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR) } source "https://gem.repo1" gem "myrack" G diff --git a/spec/bundler/support/env.rb b/spec/bundler/support/env.rb index 2d13c449fe..0899bd82a3 100644 --- a/spec/bundler/support/env.rb +++ b/spec/bundler/support/env.rb @@ -5,5 +5,9 @@ module Spec def ruby_core? File.exist?(File.expand_path("../../../lib/bundler/bundler.gemspec", __dir__)) end + + def rubylib + ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR) + end end end |
