Exemple #1
0
			Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
		})

		It("fails when the an org is not targetted", func() {
			requirementsFactory.TargetedOrgSuccess = false
			runCommand("foo.com")

			Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
		})
	})

	Context("when the domain exists", func() {
		BeforeEach(func() {
			domainRepo.FindByNameInOrgDomain = models.DomainFields{
				Name: "foo.com",
				Guid: "foo-guid",
			}
		})

		It("deletes domains", func() {
			runCommand("foo.com")

			Expect(domainRepo.DeleteDomainGuid).To(Equal("foo-guid"))

			Expect(ui.Prompts).To(ContainSubstrings([]string{"Really delete the domain foo.com"}))
			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Deleting domain", "foo.com", "my-user"},
				[]string{"OK"},
			))
		})
Exemple #2
0
					callPush("of-bel-air")

					Expect(ui.Outputs).ToNot(ContainSubstrings(
						[]string{"Error refreshing auth token"},
					))
					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"FAILED"},
						[]string{"accidentally the UAA"},
					))
				})
			})

			Context("when multiple domains are specified in manifest", func() {
				BeforeEach(func() {
					domainRepo.FindByNameInOrgDomain = []models.DomainFields{
						models.DomainFields{Name: "example1.com", Guid: "example-domain-guid"},
						models.DomainFields{Name: "example2.com", Guid: "example-domain-guid"},
					}

					manifestRepo.ReadManifestReturns.Manifest = multipleDomainsManifest()
				})

				It("creates a route for each domain", func() {
					callPush()

					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"Creating", "manifest-host.example1.com"},
						[]string{"OK"},
						[]string{"Binding", "manifest-host.example1.com"},
						[]string{"OK"},
						[]string{"Creating", "manifest-host.example2.com"},
						[]string{"OK"},
Exemple #3
0
				callPush("-t", "111", "Tim's 1st-Crazy__app!")
				Expect(*appRepo.CreatedAppParams().Name).To(Equal("Tim's 1st-Crazy__app!"))

				Expect(routeRepo.FindByHostAndDomainCalledWith.Host).To(Equal("tims-1st-crazy-app"))
				Expect(routeRepo.CreatedHost).To(Equal("tims-1st-crazy-app"))

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Creating", "tims-1st-crazy-app.foo.cf-app.com"},
					[]string{"Binding", "tims-1st-crazy-app.foo.cf-app.com"},
				))
				Expect(ui.Outputs).ToNot(ContainSubstrings([]string{"FAILED"}))
			})

			It("sets the app params from the flags", func() {
				domainRepo.FindByNameInOrgDomain = models.DomainFields{
					Name: "bar.cf-app.com",
					Guid: "bar-domain-guid",
				}
				stackRepo.FindByNameStack = models.Stack{
					Name: "customLinux",
					Guid: "custom-linux-guid",
				}

				callPush(
					"-c", "unicorn -c config/unicorn.rb -D",
					"-d", "bar.cf-app.com",
					"-n", "my-hostname",
					"-k", "4G",
					"-i", "3",
					"-m", "2G",
					"-b", "https://github.com/heroku/heroku-buildpack-play.git",
					"-s", "customLinux",
		It("fails if an organiztion is not targeted", func() {
			requirementsFactory.LoginSuccess = true

			Expect(runCommand("foo.com")).To(BeFalse())
		})
	})

	Context("when logged in and targeted an organiztion", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true
			requirementsFactory.TargetedOrgSuccess = true
			domainRepo.FindByNameInOrgDomain = []models.DomainFields{
				models.DomainFields{
					Name:   "foo.com",
					Guid:   "foo-guid",
					Shared: true,
				},
			}
		})

		Describe("and the command is invoked interactively", func() {
			BeforeEach(func() {
				ui.Inputs = []string{"y"}
			})

			It("when the domain is not found it tells the user", func() {
				domainRepo.FindByNameInOrgApiResponse = errors.NewModelNotFoundError("Domain", "foo.com")
				runCommand("foo.com")

				Expect(ui.Outputs).To(ContainSubstrings(