summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/ruby_dsl_spec.rb
diff options
context:
space:
mode:
authorNgan Pham <ngan@users.noreply.github.com>2023-08-17 21:19:58 -0700
committergit <svn-admin@ruby-lang.org>2023-08-18 19:14:14 +0000
commit3d7a0301124aa1fb4a6fc1a92baf4f2601b8d2ea (patch)
tree9e041da9d9031f4012211f7df24e7d7001a31c69 /spec/bundler/bundler/ruby_dsl_spec.rb
parente1505aebf2dd5876db227f3e0c70e9ad1c4302fd (diff)
[rubygems/rubygems] Resolve ruby version file relative to bundle root
This is a follow up to https://github.com/rubygems/rubygems/issues/6742. This change makes it so that the version file is resolved relative to the Bundle root instead of the working directory. Why is this useful? If you run a commnad (eg `rails`) from the `app/` directory, your bundle would fail to load. https://github.com/rubygems/rubygems/commit/6d47ee98b9
Diffstat (limited to 'spec/bundler/bundler/ruby_dsl_spec.rb')
-rw-r--r--spec/bundler/bundler/ruby_dsl_spec.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/bundler/bundler/ruby_dsl_spec.rb b/spec/bundler/bundler/ruby_dsl_spec.rb
index 0ba55e949f..70424312ce 100644
--- a/spec/bundler/bundler/ruby_dsl_spec.rb
+++ b/spec/bundler/bundler/ruby_dsl_spec.rb
@@ -104,7 +104,12 @@ RSpec.describe Bundler::RubyDsl do
let(:engine_version) { version }
let(:patchlevel) { nil }
let(:engine) { "ruby" }
- before { allow(Bundler).to receive(:read_file).with("foo").and_return("#{version}\n") }
+ let(:project_root) { Pathname.new("/path/to/project") }
+
+ before do
+ allow(Bundler).to receive(:read_file).with(project_root.join("foo")).and_return("#{version}\n")
+ allow(Bundler).to receive(:root).and_return(Pathname.new("/path/to/project"))
+ end
it_behaves_like "it stores the ruby version"