Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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?
  • Loading branch information...
commit cdbf57ea65176e0d8b0688699fef0310a713179e 1 parent 6a69a3d
@sethvargo sethvargo authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 spec/fetchers/git_fetcher_spec.rb
View
15 spec/fetchers/git_fetcher_spec.rb
@@ -76,22 +76,25 @@ def expect_git_ls_remote
context 'when the ref does not exist' do
let(:git_ls_remote_out) { '' }
+ let(:error_reporter) { double('ErrorReporter', explain: nil) }
+
+ before { Omnibus::Fetcher::ErrorReporter.stub(:new).and_return(error_reporter) }
it 'should clone the Git repository and then fail while retrying 3 times' do
+ expect(error_reporter).to receive(:explain)
+ .with(%|Failed to fetch git repository 'git@example.com:test/project.git'|)
+
4.times do
expect_git_clone
- 4.times do
- expect_git_ls_remote
- end
end
- expect_any_instance_of(Omnibus::Fetcher::ErrorReporter).to receive(:explain)
- .with(%q|Failed to find any commits for the ref '0.0.1'|)
+ expect_git_ls_remote
+
expect(subject).to receive(:log).with(/git ls\-remote failed/).at_least(1).times
expect(subject).to receive(:log).with(/git clone\/fetch failed/).at_least(1).times
# Prevent sleeping to run the spec fast
subject.stub(:sleep)
- expect { subject.fetch }.to raise_error(/Could not parse SHA reference/)
+ expect { subject.fetch }.to raise_error(Omnibus::UnresolvableGitReference)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.