diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 2ade1653fc..beb21f9c2b 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -309,8 +309,7 @@ RSpec.describe "bundle gem" do end it "sets a minimum ruby version" do - gemspec_path = ruby_core? ? "../../../lib/bundler" : "../.." - bundler_gemspec = Bundler::GemHelper.new(File.expand_path(gemspec_path, __dir__)).gemspec + bundler_gemspec = Bundler::GemHelper.new(gemspec_dir).gemspec expect(bundler_gemspec.required_ruby_version).to eq(generated_gemspec.required_ruby_version) end diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 73d828cb5d..9493c5422a 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -13,6 +13,10 @@ module Spec @gemspec ||= root.join(ruby_core? ? "lib/bundler/bundler.gemspec" : "bundler.gemspec") end + def gemspec_dir + @gemspec_dir ||= gemspec.parent + end + def bindir @bindir ||= root.join(ruby_core? ? "libexec" : "exe") end