Expect(err).ToNot(HaveOccurred()) Expect(importImageCmd).ToNot(BeNil()) cmd = importImageCmd }) Context("when all required options are passed", func() { It("succeeds with no errors", func() { err = cmd.CheckOptions() Expect(err).ToNot(HaveOccurred()) }) }) Context("when no required options are passed", func() { BeforeEach(func() { options.OsRefCodeFlag = "" options.UriFlag = "" }) It("fails with error that operating system reference code is missing", func() { err = cmd.CheckOptions() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("must pass an OS ref code")) }) }) Context("when one required option is missing", func() { Context("when OsRefCode is missing", func() { BeforeEach(func() { options.OsRefCodeFlag = "" })