summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-01-07 00:37:56 -0500
committerJames Wen <jrw2175@columbia.edu>2016-01-08 01:08:57 -0500
commit5dc64161d6b6310ab343f4a283fa779ae139461a (patch)
tree9e0a1b49fc499d3c8fad64618f07e8daca019bb3
parent59e90bd7ec2608661b447aa4952584ce3eda28ee (diff)
downloadbundler-5dc64161d6b6310ab343f4a283fa779ae139461a.tar.gz
Add unit tests for `Bundler::SharedHelpers#default_bundle_dir`
-rw-r--r--spec/bundler/shared_helpers_spec.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index da11fa1f09..cfd6374545 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -24,7 +24,6 @@ describe Bundler::SharedHelpers do
end
describe "#default_lockfile" do
subject { Bundler::SharedHelpers.default_lockfile }
-
context "gemfile is gems.rb" do
before do
gemfile_path = Pathname.new("/path/gems.rb")
@@ -46,6 +45,35 @@ describe Bundler::SharedHelpers do
end
end
end
+ describe "#default_bundle_dir" do
+ subject { Bundler::SharedHelpers.default_bundle_dir }
+ context ".bundle does not exist" do
+ it "returns nil" do
+ expect(subject).to eq(nil)
+ end
+ end
+ context ".bundle is global .bundle" do
+ before do
+ Dir.mkdir ".bundle"
+ global_rubygems_dir = Pathname.new("#{bundled_app}")
+ allow(Bundler.rubygems).to receive(:user_home).and_return(global_rubygems_dir)
+ end
+ it "returns nil" do
+ expect(subject).to eq(nil)
+ end
+ end
+ context ".bundle is not global .bundle" do
+ before do
+ Dir.mkdir ".bundle"
+ global_rubygems_dir = Pathname.new("/path/rubygems")
+ allow(Bundler.rubygems).to receive(:user_home).and_return(global_rubygems_dir)
+ end
+ it "returns the .bundle path" do
+ expected_bundle_dir_path = Pathname.new("#{bundled_app}/.bundle")
+ expect(subject).to eq(expected_bundle_dir_path)
+ end
+ end
+ end
describe "#const_get_safely" do
module TargetNamespace
VALID_CONSTANT = 1