spec/unit/berkshelf/locations/git_spec.rb in berkshelf-7.1.0 vs spec/unit/berkshelf/locations/git_spec.rb in berkshelf-7.2.0
- old
+ new
@@ -102,23 +102,20 @@
allow(subject).to receive(:git)
end
context "when the repository is cached" do
it "pulls a new version" do
- allow(Dir).to receive(:chdir) { |args, &b| b.call } # Force eval the chdir block
-
+ cache_path = subject.send(:cache_path)
allow(subject).to receive(:cached?).and_return(true)
expect(subject).to receive(:git).with(
- 'fetch --force --tags https://repo.com "refs/heads/*:refs/heads/*"'
+ 'fetch --force --tags https://repo.com "refs/heads/*:refs/heads/*"', cwd: cache_path.to_s
)
subject.install
end
end
context "when the revision is not cached" do
it "clones the repository" do
- allow(Dir).to receive(:chdir) { |args, &b| b.call } # Force eval the chdir block
-
cache_path = subject.send(:cache_path)
allow(subject).to receive(:cached?).and_return(false)
expect(subject).to receive(:git).with(
%{clone https://repo.com "#{cache_path}" --bare --no-hardlinks}
)