@@ -272,7 +272,7 @@ var _ = Describe("Asynchronous Assertions", func() {
272272 return MATCH
273273 }, time .Hour ).WithContext (ctx ).Should (SpecMatch ())
274274 Ω (ig .FailureMessage ).Should (ContainSubstring ("Context was cancelled after" ))
275- Ω (ig .FailureMessage ).Should (ContainSubstring ("positive: match " ))
275+ Ω (ig .FailureMessage ).Should (ContainSubstring ("There is no failure as the matcher passed to Consistently has not yet failed " ))
276276 })
277277 })
278278
@@ -291,6 +291,23 @@ var _ = Describe("Asynchronous Assertions", func() {
291291 Ω (message ).Should (Equal ("Expected\n <string>: no match\n to equal\n <string>: match" ))
292292 Ω (fakeSpecContext .Cancelled ).Should (BeTrue ())
293293 })
294+
295+ Context ("when used with consistently" , func () {
296+ It ("returns a useful message that does not invoke the matcher's failure handlers" , func () {
297+ fakeSpecContext := & FakeGinkgoSpecContext {}
298+ var message string
299+ ctx := context .WithValue (context .Background (), "GINKGO_SPEC_CONTEXT" , fakeSpecContext )
300+ ig .G .Consistently (func () error {
301+ if fakeSpecContext .Attached != nil {
302+ message = fakeSpecContext .Attached ()
303+ }
304+ return nil
305+ }).WithTimeout (time .Millisecond * 20 ).WithContext (ctx ).ShouldNot (HaveOccurred ())
306+
307+ Ω (message ).Should (Equal ("There is no failure as the matcher passed to Consistently has not yet failed" ))
308+ Ω (fakeSpecContext .Cancelled ).Should (BeTrue ())
309+ })
310+ })
294311 })
295312
296313 Describe ("the interaction between the context and the timeout" , func () {
@@ -461,7 +478,7 @@ var _ = Describe("Asynchronous Assertions", func() {
461478 return MATCH
462479 }, time .Hour ).WithContext (ctx ).Should (SpecMatch ())
463480 Ω (ig .FailureMessage ).Should (ContainSubstring ("Context was cancelled after" ))
464- Ω (ig .FailureMessage ).Should (ContainSubstring ("positive: match " ))
481+ Ω (ig .FailureMessage ).Should (ContainSubstring ("There is no failure as the matcher passed to Consistently has not yet failed " ))
465482 })
466483 })
467484
0 commit comments