Beispiel #1
0
		It("fails if the user is not logged in", func() {
			requirementsFactory.LoginSuccess = false
			context := testcmd.NewContext("stacks", []string{})
			testcmd.RunCommand(cmd, context, requirementsFactory)
			Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
		})
	})

	It("lists the stacks", func() {
		stack1 := models.Stack{
			Name:        "Stack-1",
			Description: "Stack 1 Description",
		}
		stack2 := models.Stack{
			Name:        "Stack-2",
			Description: "Stack 2 Description",
		}

		repo.FindAllStacks = []models.Stack{stack1, stack2}
		context := testcmd.NewContext("stacks", []string{})
		testcmd.RunCommand(cmd, context, requirementsFactory)

		testassert.SliceContains(ui.Outputs, testassert.Lines{
			{"Getting stacks in org", "my-org", "my-space", "my-user"},
			{"OK"},
			{"Stack-1", "Stack 1 Description"},
			{"Stack-2", "Stack 2 Description"},
		})
	})
})