Describe("Run", func() { Context("when apply spec is successfully retrieved", func() { Context("when current agent has a job spec template", func() { BeforeEach(func() { currentSpec := boshas.V1ApplySpec{} currentSpec.JobSpec.Template = "fake-job-name" specService.Spec = currentSpec }) Context("when errand script exits with non-0 exit code (execution of script is ok)", func() { BeforeEach(func() { cmdRunner.AddProcess("/fake-jobs-dir/fake-job-name/bin/run", &fakesys.FakeProcess{ WaitResult: boshsys.Result{ Stdout: "fake-stdout", Stderr: "fake-stderr", ExitStatus: 0, }, }) }) It("returns errand result without error after running an errand", func() { result, err := action.Run() Expect(err).ToNot(HaveOccurred()) Expect(result).To(Equal( ErrandResult{ Stdout: "fake-stdout", Stderr: "fake-stderr", ExitStatus: 0, }, ))