File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -76,22 +76,25 @@ def expect_git_ls_remote
76
76
77
77
context 'when the ref does not exist' do
78
78
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 ) }
79
82
80
83
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
+
81
87
4 . times do
82
88
expect_git_clone
83
- 4 . times do
84
- expect_git_ls_remote
85
- end
86
89
end
87
90
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
+
90
93
expect ( subject ) . to receive ( :log ) . with ( /git ls\- remote failed/ ) . at_least ( 1 ) . times
91
94
expect ( subject ) . to receive ( :log ) . with ( /git clone\/ fetch failed/ ) . at_least ( 1 ) . times
92
95
# Prevent sleeping to run the spec fast
93
96
subject . stub ( :sleep )
94
- expect { subject . fetch } . to raise_error ( /Could not parse SHA reference/ )
97
+ expect { subject . fetch } . to raise_error ( Omnibus :: UnresolvableGitReference )
95
98
end
96
99
end
97
100
end
You can’t perform that action at this time.
0 commit comments