}) }) Context("when logged in and provided the name of an org to create", func() { BeforeEach(func() { requirementsFactory.LoginSuccess = true }) It("creates an org", func() { runCommand("my-org") Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating org", "my-org", "my-user"}, []string{"OK"}, )) Expect(orgRepo.CreateName).To(Equal("my-org")) }) It("fails and warns the user when the org already exists", func() { orgRepo.CreateOrgExists = true runCommand("my-org") Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating org", "my-org"}, []string{"OK"}, []string{"my-org", "already exists"}, )) }) }) })