It("returns an error", func() { _, err := GetBuild(client, expectedJobName, expectedBuildName, expectedPipelineName) Expect(err).To(MatchError("build not found")) }) }) }) Context("when nothing is passed", func() { expectedOneOffBuild := atc.Build{ ID: 123, Name: expectedBuildName, Status: "Great Success", JobName: "", URL: fmt.Sprintf("/builds/%s", expectedBuildID), APIURL: fmt.Sprintf("api/v1/builds/%s", expectedBuildID), } BeforeEach(func() { client.AllBuildsReturns([]atc.Build{expectedBuild, expectedOneOffBuild}, nil) }) It("returns latest one off build", func() { build, err := GetBuild(client, "", "", "") Expect(err).NotTo(HaveOccurred()) Expect(build).To(Equal(expectedOneOffBuild)) Expect(client.AllBuildsCallCount()).To(Equal(1)) }) }) }) })