}) It("fails when the number of arguments is less than two", func() { requirementsFactory.LoginSuccess = true requirementsFactory.TargetedOrgSuccess = true runCommand("foobar.example.com") Expect(testcmd.CommandDidPassRequirements).To(BeFalse()) Expect(ui.FailedWithUsage).To(BeTrue()) }) }) Context("when the route already exists", func() { BeforeEach(func() { requirementsFactory.LoginSuccess = true requirementsFactory.TargetedOrgSuccess = true routeRepo.CheckIfExistsFound = true }) It("prints out route does exist", func() { requirementsFactory.LoginSuccess = true requirementsFactory.TargetedOrgSuccess = true runCommand("some-existing-route", "example.com") Expect(ui.Outputs).To(ContainSubstrings( []string{"Checking for route..."}, []string{"OK"}, []string{"Route some-existing-route.example.com does exist"}, )) }) })