_, err = cmd.Requirements(factory, flagContext) Expect(err).NotTo(HaveOccurred()) }) It("tells the user it is creating the service broker", func() { cmd.Execute(flagContext) Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating service broker", "service-broker", "my-user"}, []string{"OK"}, )) }) It("tries to create the service broker", func() { cmd.Execute(flagContext) Expect(serviceBrokerRepo.CreateCallCount()).To(Equal(1)) name, url, username, password, spaceGUID := serviceBrokerRepo.CreateArgsForCall(0) Expect(name).To(Equal("service-broker")) Expect(url).To(Equal("url")) Expect(username).To(Equal("username")) Expect(password).To(Equal("password")) Expect(spaceGUID).To(Equal("")) }) Context("when the --space-scoped flag is passed", func() { BeforeEach(func() { err := flagContext.Parse("service-broker", "username", "password", "url", "--space-scoped") Expect(err).NotTo(HaveOccurred()) }) It("tries to create the service broker with the targeted space guid", func() { cmd.Execute(flagContext)