summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-07-10 23:24:40 -0400
committerSamuel Giddins <segiddins@segiddins.me>2016-07-19 17:13:44 -0500
commitbdffe5f02d91bcdf5c71537746189b9974e8ea97 (patch)
tree99dccfff3a22b2f9360b1d50fa7702fc55192824
parentacbe52cf066143a596b074d5d66d6ee6cee5513c (diff)
downloadbundler-bdffe5f02d91bcdf5c71537746189b9974e8ea97.tar.gz
Fully reset in between each spec run
-rw-r--r--lib/bundler.rb12
-rw-r--r--spec/bundler/shared_helpers_spec.rb4
-rw-r--r--spec/support/helpers.rb2
3 files changed, 10 insertions, 8 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index de186ef3ed..a926ee1dcd 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -130,13 +130,11 @@ module Bundler
end
def locked_gems
- return @locked_gems if defined?(@locked_gems)
- if Bundler.default_lockfile.exist?
- lock = Bundler.read_file(Bundler.default_lockfile)
- @locked_gems = LockfileParser.new(lock)
- else
- @locked_gems = nil
- end
+ @locked_gems ||=
+ if Bundler.default_lockfile.exist?
+ lock = Bundler.read_file(Bundler.default_lockfile)
+ LockfileParser.new(lock)
+ end
end
def ruby_scope
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index 2ad0c98dba..39ad2957ce 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -209,6 +209,10 @@ describe Bundler::SharedHelpers do
end
describe "#set_bundle_environment" do
+ before do
+ ENV["BUNDLE_GEMFILE"] = "Gemfile"
+ end
+
shared_examples_for "ENV['PATH'] gets set correctly" do
before { Dir.mkdir ".bundle" }
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 34335ee1a3..bd88fdac68 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -13,7 +13,7 @@ module Spec
FileUtils.mkdir_p(tmp)
FileUtils.mkdir_p(home)
ENV["BUNDLE_DISABLE_POSTIT"] = "1"
- Bundler.send(:remove_instance_variable, :@settings) if Bundler.send(:instance_variable_defined?, :@settings)
+ Bundler.reset!
Bundler.ui = nil
Bundler.ui # force it to initialize
end