Forráskód Böngészése

`error: aString` to mock error signal during request.

Herby Vojčík 7 éve
szülő
commit
665dded143
2 módosított fájl, 9 hozzáadás és 1 törlés
  1. 5 0
      src/Znock/ZnockBase.class.st
  2. 4 1
      src/Znock/ZnockClient.class.st

+ 5 - 0
src/Znock/ZnockBase.class.st

@@ -51,6 +51,11 @@ ZnockBase >> doesNotUnderstand: aMessage [
 	^ super doesNotUnderstand: aMessage
 ]
 
+{ #category : #public }
+ZnockBase >> error: aString [
+	self response: (Error new messageText: aString; yourself)
+]
+
 { #category : #building }
 ZnockBase >> openState: aSymbol [
 	aSymbol == #request ifTrue: [

+ 4 - 1
src/Znock/ZnockClient.class.st

@@ -17,7 +17,10 @@ ZnockClient class >> newWithInterceptor: aZnock [
 { #category : #'private protocol' }
 ZnockClient >> executeRequestResponse [
 	^ (interceptor consumeExpectationFor: self)
-		ifNotNil: [ :expectation | response := expectation response. response contents ]
+		ifNotNil: [ :expectation |
+			response := expectation response.
+			(response respondsTo: #signal) ifTrue: [ response signal ].
+			response contents ]
 		ifNil: [ super executeRequestResponse ]
 ]