Context("when VM is found with given CID", func() { It("returns true without error", func() { vmFinder.FindFound = true found, err := action.Run(1234) Expect(err).ToNot(HaveOccurred()) Expect(found).To(BeTrue()) }) }) Context("when VM is not found with given CID", func() { It("returns false without error", func() { found, err := action.Run(1234) Expect(err).ToNot(HaveOccurred()) Expect(found).To(BeFalse()) }) }) Context("when VM finding fails", func() { It("returns error", func() { vmFinder.FindErr = errors.New("fake-find-err") found, err := action.Run(1234) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-find-err")) Expect(found).To(BeFalse()) }) }) }) })