diff options
author | James Wen <jrw2175@columbia.edu> | 2016-01-08 20:19:06 -0500 |
---|---|---|
committer | James Wen <jrw2175@columbia.edu> | 2016-01-10 01:44:07 -0500 |
commit | d9aa33effe34755f81a957f3afb1e71fa97eee17 (patch) | |
tree | a6e3710cc6c780adea083774b494a2e7cebf563b /spec/bundler | |
parent | 7205df2b5efbf909de426e60b1374b0f1032a353 (diff) | |
download | bundler-d9aa33effe34755f81a957f3afb1e71fa97eee17.tar.gz |
Add unit tests for `Bundler::SharedHelpers` public methods `#chdir` and `#pwd`
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 56682400..7dbfcbde 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -2,6 +2,13 @@ require "spec_helper" require "bundler/shared_helpers" describe Bundler::SharedHelpers do + before do + ext_lock_double = double(:ext_lock) + allow(Bundler.rubygems).to receive(:ext_lock).and_return(ext_lock_double) + allow(ext_lock_double).to receive(:synchronize) do |&block| + block.call + end + end subject { Bundler::SharedHelpers } describe "#default_gemfile" do before do @@ -113,6 +120,21 @@ describe Bundler::SharedHelpers do it_behaves_like "correctly determines whether to return a Gemfile path" end end + describe "#chdir" do + before do + Dir.mkdir "chdir_test_dir" + end + it "executes the passed block while in the specified directory" do + op_block = proc { Dir.mkdir "nested_dir" } + subject.chdir("chdir_test_dir", &op_block) + expect(Pathname.new("chdir_test_dir/nested_dir")).to exist + end + end + describe "#pwd" do + it "returns the current absolute path" do + expect(subject.pwd).to eq(bundled_app) + end + end describe "#set_bundle_environment" do shared_examples_for "ENV['PATH'] gets set correctly" do before do |