summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/install/git_spec.rb22
-rw-r--r--spec/support/builders.rb6
2 files changed, 27 insertions, 1 deletions
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index ae9e5a145b..5c537beccd 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -875,4 +875,26 @@ describe "bundle install with git sources" do
end
end
+ it 'ignores git environment variables' do
+ build_git "xxxxxx" do |s|
+ s.executables = "xxxxxxbar"
+ end
+
+ Bundler::SharedHelpers.with_clean_git_env do
+ ENV['GIT_DIR'] = 'bar'
+ ENV['GIT_WORK_TREE'] = 'bar'
+
+ result = install_gemfile <<-G, :exitstatus => true
+ source "file://#{gem_repo1}"
+ git "#{lib_path('xxxxxx-1.0')}" do
+ gem 'xxxxxx'
+ end
+ G
+
+ expect(exitstatus).to eq(0)
+ expect(ENV['GIT_DIR']).to eq('bar')
+ expect(ENV['GIT_WORK_TREE']).to eq('bar')
+ end
+ end
+
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index 856f0479cc..05c09a0b44 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -1,3 +1,5 @@
+require 'bundler/shared_helpers'
+
module Spec
module Builders
def self.constantize(name)
@@ -588,7 +590,9 @@ module Spec
private
def git(cmd)
- Dir.chdir(@path) { `git #{cmd}`.strip }
+ Bundler::SharedHelpers.with_clean_git_env do
+ Dir.chdir(@path) { `git #{cmd}`.strip }
+ end
end
end