spec/unit/fetchers/path_fetcher_spec.rb in omnibus-5.0.0 vs spec/unit/fetchers/path_fetcher_spec.rb in omnibus-5.1.0

- old
+ new

@@ -45,44 +45,13 @@ expect(subject.version_guid).to eq("path:#{source_path}") end end describe '#clean' do - before do - allow(FileUtils).to receive(:rm_rf) - allow(subject).to receive(:fetch) + it 'returns true' do + expect(subject.clean).to be_truthy end - - context 'when the directory exists' do - before do - allow(File).to receive(:exist?).with(project_dir).and_return(true) - end - - it 'removes the directory' do - expect(FileUtils).to receive(:rm_rf).with(project_dir).once - subject.clean - end - - it 'returns true' do - expect(subject.clean).to be_truthy - end - end - - context 'when the directory does not exist' do - before do - allow(File).to receive(:exist?).with(project_dir).and_return(false) - end - - it 'does not remove the directory' do - expect(FileUtils).to_not receive(:rm_rf) - subject.clean - end - - it 'returns false' do - expect(subject.clean).to be(false) - end - end end describe '#fetch' do before do allow(subject).to receive(:create_required_directories) @@ -98,14 +67,14 @@ describe '#version_for_cache' do let(:shasum) { 'abcd1234' } before do allow(subject).to receive(:digest_directory) - .with(project_dir, :sha256) + .with(source_path, :sha256, {}) .and_return(shasum) end - it 'returns the shasum of the project_dir' do + it 'returns the shasum of the source directory' do expect(subject.version_for_cache).to eq("path:#{source_path}|shasum:#{shasum}") end end end end