Expect(fakeOrgRepo.FindByNameArgsForCall(0)).To(Equal("org")) Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, []string{"Org", "org", "not found"}, )) }) }) Context("when the space does not exist", func() { BeforeEach(func() { org := models.Organization{} org.Name = "org-name" org.Guid = "org-guid" fakeOrgRepo.ListOrgsReturns([]models.Organization{org}, nil) fakeOrgRepo.FindByNameReturns(org, nil) fakeSpaceRepo.FindByNameInOrgError = errors.NewModelNotFoundError("Space", "space-name") }) It("fails and tells the user", func() { runCommand("sec group", "org-name", "space-name") Expect(fakeSpaceRepo.FindByNameInOrgName).To(Equal("space-name")) Expect(fakeSpaceRepo.FindByNameInOrgOrgGuid).To(Equal("org-guid")) Expect(ui.Outputs).To(ContainSubstrings( []string{"FAILED"}, []string{"Space", "space-name", "not found"}, )) }) }) Context("everything is hunky dory", func() {