|
49 | 49 | expect(stub_repo).to have_received(:pull) |
50 | 50 | end |
51 | 51 |
|
| 52 | + it 'clones a repo before pulling if it does not exist' do |
| 53 | + harvester.pull(repo_name) |
| 54 | + expect(Git).to have_received(:clone) |
| 55 | + end |
| 56 | + end |
| 57 | + |
| 58 | + describe '#pull_all' do |
52 | 59 | it 'can pull all repositories' do |
53 | | - harvester.pull |
| 60 | + harvester.pull_all |
54 | 61 | expect(Git).to have_received(:open).exactly(2).times |
55 | 62 | expect(stub_repo).to have_received(:pull).exactly(2).times |
56 | 63 | end |
57 | 64 |
|
58 | | - it 'skips repositories in the denylist' do |
59 | | - harvester.pull |
60 | | - expect(Git).not_to have_received(:open).with('https://github.com/OpenGeoMetadata/aardvark.git') |
61 | | - end |
62 | | - |
63 | | - it 'clones a repo before pulling if it does not exist' do |
64 | | - harvester.pull(repo_name) |
65 | | - expect(Git).to have_received(:clone) |
| 65 | + it 'returns the count of repositories pulled' do |
| 66 | + expect(harvester.pull_all).to eq(2) |
66 | 67 | end |
67 | 68 |
|
68 | | - it 'returns the count of repositories pulled' do |
69 | | - expect(harvester.pull).to eq(2) |
| 69 | + it 'skips repositories in the denylist' do |
| 70 | + harvester.pull_all |
| 71 | + expect(Git).not_to have_received(:open).with('https://github.com/OpenGeoMetadata/aardvark.git') |
70 | 72 | end |
71 | 73 | end |
72 | 74 |
|
|
75 | 77 | harvester.clone(repo_name) |
76 | 78 | expect(Git).to have_received(:clone).with( |
77 | 79 | repo_url, |
78 | | - repo_name, { |
| 80 | + nil, { |
79 | 81 | depth: 1, # shallow clone |
80 | | - path: repo_path |
| 82 | + path: harvester.ogm_path |
81 | 83 | } |
82 | 84 | ) |
83 | 85 | end |
84 | 86 |
|
| 87 | + it 'skips repositories that already exist' do |
| 88 | + allow(File).to receive(:directory?).with(repo_path).and_return(true) |
| 89 | + harvester.clone(repo_name) |
| 90 | + expect(Git).not_to have_received(:clone) |
| 91 | + end |
| 92 | + end |
| 93 | + |
| 94 | + describe '#clone_all' do |
85 | 95 | it 'can clone all repositories' do |
86 | | - harvester.clone |
| 96 | + harvester.clone_all |
87 | 97 | expect(Git).to have_received(:clone).exactly(2).times |
88 | 98 | end |
89 | 99 |
|
90 | 100 | it 'skips repositories in the denylist' do |
91 | | - harvester.pull |
| 101 | + harvester.clone_all |
92 | 102 | expect(Git).not_to have_received(:clone).with('https://github.com/OpenGeoMetadata/aardvark.git') |
93 | 103 | end |
94 | 104 |
|
95 | | - it 'skips repositories that already exist' do |
96 | | - allow(File).to receive(:directory?).with(repo_path).and_return(true) |
97 | | - harvester.clone(repo_name) |
98 | | - expect(Git).not_to have_received(:clone) |
99 | | - end |
100 | | - |
101 | 105 | it 'returns the count of repositories cloned' do |
102 | | - expect(harvester.clone).to eq(2) |
| 106 | + expect(harvester.clone_all).to eq(2) |
103 | 107 | end |
104 | 108 | end |
105 | 109 | end |
0 commit comments