requirementsFactory.LoginSuccess = true requirementsFactory.TargetedOrgSuccess = true passed := runCommand("foobar.example.com") Expect(passed).To(BeFalse()) Expect(ui.Outputs).To(ContainSubstrings( []string{"Incorrect Usage", "Requires", "arguments"}, )) }) }) 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"}, )) }) })