Example #1
0
					expectedVersion, err := semver.Make("2.53.0")
					Expect(err).NotTo(HaveOccurred())

					Expect(factory.NewMinAPIVersionRequirementCallCount()).To(Equal(1))
					feature, requiredVersion := factory.NewMinAPIVersionRequirementArgsForCall(0)
					Expect(feature).To(Equal("Option '--port'"))
					Expect(requiredVersion).To(Equal(expectedVersion))
					Expect(actualRequirements[0]).To(Equal(minAPIVersionRequirement))
				})

				It("returns a DiegoApplicationRequirement", func() {
					actualRequirements, err := cmd.Requirements(factory, flagContext)
					Expect(err).NotTo(HaveOccurred())

					Expect(factory.NewDiegoApplicationRequirementCallCount()).To(Equal(1))
					actualAppName := factory.NewDiegoApplicationRequirementArgsForCall(0)
					Expect(appName).To(Equal(actualAppName))
					Expect(actualRequirements).NotTo(BeEmpty())
				})
			})

			Context("when the --random-port option is given", func() {
				appName := "app-name"

				BeforeEach(func() {
					err := flagContext.Parse(appName, "domain-name", "--random-port")
					Expect(err).NotTo(HaveOccurred())
				})

				It("returns a MinAPIVersionRequirement", func() {
					expectedVersion, err := semver.Make("2.53.0")