コード例 #1
0
	Describe("#Description", func() {
		It("returns the description of a BmsCommand", func() {
			Expect(cmd.Description()).To(Equal("List all bare metals"))
		})
	})

	Describe("#Usage", func() {
		It("returns the usage text of a BmsCommand", func() {
			Expect(cmd.Usage()).To(Equal("bmp bms --deployment[-d] <deployment file>"))
		})
	})

	Describe("#Options", func() {
		It("returns the options of a BmsCommand", func() {
			Expect(cmds.EqualOptions(cmd.Options(), options)).To(BeTrue())

			Expect(cmd.Options().Deployment).ToNot(Equal(""))
			Expect(cmd.Options().Deployment).To(Equal("../../test_fixtures/bmp/deployment.yml"))
		})
	})

	Describe("#Validate", func() {
		It("validates a good BmsCommand", func() {
			validate, err := cmd.Validate()
			Expect(validate).To(BeTrue())
			Expect(err).ToNot(HaveOccurred())
		})

		Context("bad BmsCommand", func() {
			BeforeEach(func() {
コード例 #2
0
				Packages:       true,
				PackageOptions: "test-package-options",
			}

			opts2 = cmds.Options{
				Help:           false,
				Verbose:        true,
				DryRun:         false,
				Latest:         0,
				Packages:       true,
				PackageOptions: "test-package-options",
			}
		})

		It("returns true for the same options", func() {
			Expect(cmds.EqualOptions(opts1, opts1)).To(BeTrue())
			Expect(cmds.EqualOptions(opts2, opts2)).To(BeTrue())
		})

		It("returns true for two equal options", func() {
			Expect(cmds.EqualOptions(opts1, opts2)).To(BeTrue())
		})

		It("returns false when options2 is modified", func() {
			opts2.Verbose = false
			Expect(cmds.EqualOptions(opts1, opts2)).To(BeFalse())
		})

		It("returns false when one options is empty options", func() {
			Expect(cmds.EqualOptions(cmds.Options{}, opts2)).To(BeFalse())
			Expect(cmds.EqualOptions(opts1, cmds.Options{})).To(BeFalse())