It("tries to find stemcell with given stemcell cid", func() { _, err := action.Run(1234) Expect(err).ToNot(HaveOccurred()) Expect(stemcellFinder.FindID).To(Equal(1234)) }) Context("when stemcell is found with given stemcell cid", func() { var ( stemcell *fakestem.FakeStemcell ) BeforeEach(func() { stemcell = fakestem.NewFakeStemcell(1234, "fake-stemcell-id", fakestem.FakeStemcellKind) stemcellFinder.FindStemcell = stemcell stemcellFinder.FindFound = true }) It("does not delete stemcell", func() { _, err := action.Run(1234) Expect(err).ToNot(HaveOccurred()) Expect(stemcell.DeleteCalled).To(BeFalse()) }) It("logs instead of returning error if deleting stemcell fails", func() { stemcell.DeleteErr = errors.New("fake-delete-err") _, err := action.Run(1234) Expect(err).ToNot(HaveOccurred()) })