Describe("Execute", func() {
		Context("when router-group flag is set", func() {
			BeforeEach(func() {
				routerGroups = models.RouterGroups{
					models.RouterGroup{
						Name: "router-group-name",
						GUID: "router-group-guid",
						Type: "router-group-type",
					},
				}
				flagContext.Parse("domain-name", "--router-group", "router-group-name")
			})

			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(factory.NewMinAPIVersionRequirementCallCount()).To(Equal(1))
					feature, requiredVersion := factory.NewMinAPIVersionRequirementArgsForCall(0)
					Expect(feature).To(Equal("Option '--router-group'"))
					Expect(requiredVersion).To(Equal(expectedVersion))
					Expect(actualRequirements).To(ContainElement(minAPIVersionRequirement))
				})
			})
		})
	})

	Describe("Execute", func() {
		var err error

		JustBeforeEach(func() {
			err = cmd.Execute(flagContext)
		})

		Context("when router-group flag is set", func() {
			BeforeEach(func() {
				routerGroups = models.RouterGroups{
					models.RouterGroup{
						Name: "router-group-name",
						GUID: "router-group-guid",
						Type: "router-group-type",
					},
				}
				flagContext.Parse("domain-name", "--router-group", "router-group-name")
			})

			It("tries to retrieve the router group", func() {