summaryrefslogtreecommitdiff
path: root/spec/runtime
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-07 23:56:16 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-16 15:44:53 -0400
commitd5729d251b54d7272fd1e0d675c37b7ac5618a35 (patch)
tree211709203dde6d3fc932db5d344347fd2fc5ec49 /spec/runtime
parent97c8e428318c6dab46ccef5c00d4c096d31d41fe (diff)
downloadbundler-d5729d251b54d7272fd1e0d675c37b7ac5618a35.tar.gz
Previous approach for not walking further up from test folderbetter_test_specific_file_searching
I tried monkeypatching the gemfile finder methods in hax.rb, but that resulted in loading parts of bundler too early, and getting redefinition warnings when loading them again from exe/bundle, resulting in actual errors in some cases. The fix for that required eagerly loading the monkeypatched parts of bundler, but that involves changing lib just for the sake of making existing tests pass, and that's what the original changes intend to avoid. So, I'm just reverting to the previous approach of setting an environment variable just for testing and check that. Reverts 11597fef24274bf1542384512faed697d7f41e3b.
Diffstat (limited to 'spec/runtime')
-rw-r--r--spec/runtime/gem_tasks_spec.rb2
-rw-r--r--spec/runtime/load_spec.rb14
2 files changed, 14 insertions, 2 deletions
diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb
index f0f48a01ac..eb9db56ead 100644
--- a/spec/runtime/gem_tasks_spec.rb
+++ b/spec/runtime/gem_tasks_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "require 'bundler/gem_tasks'" do
it "includes the relevant tasks" do
with_gem_path_as(Spec::Path.base_system_gems.to_s) do
- sys_exec "#{rake} -T"
+ sys_exec "#{rake} -T", "RUBYOPT" => "-I#{bundler_path}"
end
expect(err).to eq("")
diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb
index 05ed076b6d..b74dbde3f6 100644
--- a/spec/runtime/load_spec.rb
+++ b/spec/runtime/load_spec.rb
@@ -45,7 +45,6 @@ RSpec.describe "Bundler.load" do
describe "without a gemfile" do
it "raises an exception if the default gemfile is not found" do
- ensure_no_gemfile
expect do
Bundler.load
end.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
@@ -57,6 +56,19 @@ RSpec.describe "Bundler.load" do
Bundler.load
end.to raise_error(Bundler::GemfileNotFound, /omg\.rb/)
end
+
+ it "does not find a Gemfile above the testing directory" do
+ bundler_gemfile = tmp.join("../Gemfile")
+ unless File.exist?(bundler_gemfile)
+ FileUtils.touch(bundler_gemfile)
+ @remove_bundler_gemfile = true
+ end
+ begin
+ expect { Bundler.load }.to raise_error(Bundler::GemfileNotFound)
+ ensure
+ bundler_gemfile.rmtree if @remove_bundler_gemfile
+ end
+ end
end
describe "when called twice" do