spec/functional/fetchers/path_fetcher_spec.rb in omnibus-5.0.0 vs spec/functional/fetchers/path_fetcher_spec.rb in omnibus-5.1.0
- old
+ new
@@ -53,48 +53,48 @@
it 'includes the source path' do
expect(subject.version_guid).to eq("path:#{source_path}")
end
end
- describe '#clean' do
- context 'when the project directory exists' do
- before do
- create_file("#{source_path}/file_a")
- create_file("#{source_path}/file_b")
- create_file("#{source_path}/.file_c")
+ describe "#fetch" do
+ before do
+ create_file("#{source_path}/file_a")
+ create_file("#{source_path}/file_b")
+ create_file("#{source_path}/.file_c")
+ remove_file("#{source_path}/file_d")
- create_file("#{project_dir}/file_a")
- end
+ create_file("#{project_dir}/file_a")
+ remove_file("#{project_dir}/file_b")
+ remove_file("#{project_dir}/.file_c")
+ create_file("#{project_dir}/file_d")
+ end
- it 'fetches new files' do
- subject.clean
+ it 'fetches new files' do
+ subject.fetch
- expect("#{project_dir}/file_a").to be_a_file
- expect("#{project_dir}/file_b").to be_a_file
- expect("#{project_dir}/.file_c").to be_a_file
- end
-
- it 'returns true' do
- expect(subject.clean).to be_truthy
- end
+ expect("#{project_dir}/file_a").to be_a_file
+ expect("#{project_dir}/file_b").to be_a_file
+ expect("#{project_dir}/.file_c").to be_a_file
end
- context 'when the project directory does not exist' do
- before do
- remove_directory(project_dir)
- end
+ it 'removes extraneous files' do
+ subject.fetch
- it 'returns false' do
- expect(subject.clean).to be(false)
- end
+ expect("#{project_dir}/file_d").to_not be_a_file
end
end
+ describe '#clean' do
+ it 'returns true' do
+ expect(subject.clean).to be_truthy
+ end
+ end
+
describe '#version_for_cache' do
before do
- create_file("#{project_dir}/file_a")
- create_file("#{project_dir}/file_b")
- create_file("#{project_dir}/.file_c")
+ create_file("#{source_path}/file_a")
+ create_file("#{source_path}/file_b")
+ create_file("#{source_path}/.file_c")
end
let(:sha) { '69553b23b84e69e095b4a231877b38022b1ffb41ae0ecbba6bb2625410c49f7e' }
it 'includes the source_path and shasum' do