Skip to content

Commit cdbf57e

Browse files
committed
Fix the broken spec for git fetcher
In other news, what is this spec? Why does it exist? How many kittens were killed in the process of creating this spec?
1 parent 6a69a3d commit cdbf57e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

spec/fetchers/git_fetcher_spec.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,25 @@ def expect_git_ls_remote
7676

7777
context 'when the ref does not exist' do
7878
let(:git_ls_remote_out) { '' }
79+
let(:error_reporter) { double('ErrorReporter', explain: nil) }
80+
81+
before { Omnibus::Fetcher::ErrorReporter.stub(:new).and_return(error_reporter) }
7982

8083
it 'should clone the Git repository and then fail while retrying 3 times' do
84+
expect(error_reporter).to receive(:explain)
85+
.with(%|Failed to fetch git repository 'git@example.com:test/project.git'|)
86+
8187
4.times do
8288
expect_git_clone
83-
4.times do
84-
expect_git_ls_remote
85-
end
8689
end
8790

88-
expect_any_instance_of(Omnibus::Fetcher::ErrorReporter).to receive(:explain)
89-
.with(%q|Failed to find any commits for the ref '0.0.1'|)
91+
expect_git_ls_remote
92+
9093
expect(subject).to receive(:log).with(/git ls\-remote failed/).at_least(1).times
9194
expect(subject).to receive(:log).with(/git clone\/fetch failed/).at_least(1).times
9295
# Prevent sleeping to run the spec fast
9396
subject.stub(:sleep)
94-
expect { subject.fetch }.to raise_error(/Could not parse SHA reference/)
97+
expect { subject.fetch }.to raise_error(Omnibus::UnresolvableGitReference)
9598
end
9699
end
97100
end

0 commit comments

Comments
 (0)