Created
October 18, 2016 12:15
-
-
Save csmith0651/dad4a1559808f26546c9e78cf7a32ade to your computer and use it in GitHub Desktop.
prime a mock call to return an error and test for it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context("simulate an error retrieving data from S3", func() { | |
var testCall *gomock.Call | |
BeforeEach(func() { | |
testCall = mockFetcher.EXPECT().GetObject(gomock.Any()).Return(nil, fmt.Errorf("AWS error")).AnyTimes() | |
}) | |
It("and fails", func() { | |
_, err := ReadPersonFromS3(mockFetcher) | |
Expect(err).To(HaveOccurred()) | |
testCall.Times(1) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment