Пример #1
0
				AfterEach(func() {
					domainFields = []models.DomainFields{}
				})

				It("prints domain information with router group type", func() {
					cmd.Execute(flagContext)
					Expect(ui.Outputs).To(ContainSubstrings(
						[]string{"name", "status", "type"},
						[]string{"Shared-domain1", "shared", "tcp"},
					))
				})

				Context("when list router groups returns error", func() {
					BeforeEach(func() {
						routingApiRepo.ListRouterGroupsReturns(errors.New("router-group-err"))
					})

					It("fails with error message", func() {
						Expect(func() { cmd.Execute(flagContext) }).To(Panic())
						Expect(ui.Outputs).To(ContainSubstrings(
							[]string{"FAILED"},
							[]string{"Failed fetching router groups."},
							[]string{"router-group-err"},
						))
					})
				})

				Context("when router group does not exists", func() {
					BeforeEach(func() {
						routerGroups = models.RouterGroups{}
Пример #2
0
		})
	})

	Context("when there are no router groups", func() {
		It("tells the user when no router groups were found", func() {
			runCommand()

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Getting router groups"},
				[]string{"No router groups found"},
			))
		})
	})

	Context("when there is an error listing router groups", func() {
		BeforeEach(func() {
			routingApiRepo.ListRouterGroupsReturns(errors.New("BOOM"))
		})

		It("returns an error to the user", func() {
			runCommand()

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Getting router groups"},
				[]string{"Failed fetching router groups"},
			))
		})
	})

})