summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-08-06 11:46:26 -0700
committerCarl Lerche <carllerche@mac.com>2010-08-06 11:51:55 -0700
commit27800e7961165fe7582098fe9f9c52bd10fbbd97 (patch)
tree2f27f12ce8e5dd37cb3776a88414727487b35653 /spec
parent998863c729389eb79e8e4ac33982325dd329db89 (diff)
downloadbundler-27800e7961165fe7582098fe9f9c52bd10fbbd97.tar.gz
Provide an environment variable to allow customizing the location of <app>/.bundle
Diffstat (limited to 'spec')
-rw-r--r--spec/other/config_spec.rb40
-rw-r--r--spec/spec_helper.rb3
2 files changed, 42 insertions, 1 deletions
diff --git a/spec/other/config_spec.rb b/spec/other/config_spec.rb
new file mode 100644
index 0000000000..6d059e90ff
--- /dev/null
+++ b/spec/other/config_spec.rb
@@ -0,0 +1,40 @@
+require "spec_helper"
+
+describe ".bundle/config" do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
+ G
+ end
+
+ it "can be moved with an environment variable" do
+ ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
+ bundle "install vendor"
+
+ bundled_app('.bundle').should_not exist
+ tmp('foo/bar/config').should exist
+ should_be_installed "rack 1.0.0"
+ end
+
+ it "can provide a relative path with the environment variable" do
+ FileUtils.mkdir_p bundled_app('omg')
+ Dir.chdir bundled_app('omg')
+
+ ENV['BUNDLE_APP_CONFIG'] = "../foo"
+ bundle "install vendor"
+
+ bundled_app(".bundle").should_not exist
+ bundled_app("../foo/config").should exist
+ should_be_installed "rack 1.0.0"
+ end
+
+ it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
+ FileUtils.mkdir_p(tmp('foo/bar'))
+ ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
+ bundle "install"
+ FileUtils.touch tmp('foo/bar/environment.rb')
+ should_be_installed "rack 1.0.0"
+ tmp('foo/bar/environment.rb').should_not exist
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 666e2b62a4..e74d6f23ee 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -64,6 +64,7 @@ RSpec.configure do |config|
ENV['BUNDLE_GEMFILE'] = nil
ENV['BUNDLER_TEST'] = nil
ENV['BUNDLER_SPEC_PLATFORM'] = nil
- ENV['BUNDLER_SPEC_VERSION'] = nil
+ ENV['BUNDLER_SPEC_VERSION'] = nil
+ ENV['BUNDLE_APP_CONFIG'] = nil
end
end