var templateData TemplateData var fetchErr error BeforeEach(func() { fakeClient = new(cfakes.FakeClient) }) JustBeforeEach(func() { templateData, fetchErr = FetchTemplateData("some-pipeline", fakeClient, "some-job", concourse.Page{ Since: 398, Until: 2, }) }) It("calls to get the pipeline config", func() { Expect(fakeClient.PipelineCallCount()).To(Equal(1)) Expect(fakeClient.PipelineArgsForCall(0)).To(Equal("some-pipeline")) }) Context("when getting the pipeline returns an error", func() { var expectedErr error BeforeEach(func() { expectedErr = errors.New("disaster") fakeClient.PipelineReturns(atc.Pipeline{}, false, expectedErr) }) It("returns an error if the config could not be loaded", func() { Expect(fetchErr).To(Equal(expectedErr)) }) })