It("tries to retrieve the router group", func() { cmd.Execute(flagContext) Expect(routingApiRepo.ListRouterGroupsCallCount()).To(Equal(1)) }) It("prints a message", func() { cmd.Execute(flagContext) Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating shared domain domain-name"}, )) }) It("tries to create a shared domain with router group", func() { cmd.Execute(flagContext) Expect(domainRepo.CreateSharedDomainCallCount()).To(Equal(1)) domainName, routerGroupGuid := domainRepo.CreateSharedDomainArgsForCall(0) Expect(domainName).To(Equal("domain-name")) Expect(routerGroupGuid).To(Equal("router-group-guid")) }) It("prints success message", func() { cmd.Execute(flagContext) Expect(ui.Outputs).To(ContainSubstrings( []string{"OK"}, )) }) Context("when listing router groups returns an error", func() { BeforeEach(func() { routingApiRepo.ListRouterGroupsReturns(errors.New("router-group-error")) })
It("TestShareDomainRequirements", func() { Expect(runCommand("example.com")).To(BeTrue()) requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: false} Expect(runCommand("example.com")).To(BeFalse()) }) It("TestShareDomainFailsWithUsage", func() { runCommand() Expect(ui.Outputs).To(ContainSubstrings( []string{"Incorrect Usage", "Requires an argument"}, )) runCommand("example.com") Expect(ui.Outputs).ToNot(ContainSubstrings( []string{"Incorrect Usage", "Requires an argument"}, )) }) It("TestShareDomain", func() { runCommand("example.com") Expect(domainRepo.CreateSharedDomainArgsForCall(0)).To(Equal("example.com")) Expect(ui.Outputs).To(ContainSubstrings( []string{"Creating shared domain", "example.com", "my-user"}, []string{"OK"}, )) }) })