Exemplo n.º 1
0
)

var _ = Describe("Deactivate", func() {
	var (
		context *cli.Context
		set     *flag.FlagSet
	)

	BeforeEach(func() {
		os.Clearenv()

		set = flag.NewFlagSet("test", 0)
		set.String("profile", "profile-name", "doc")
		command := cli.Command{Name: "ap"}
		context = cli.NewContext(nil, set, nil)
		context.Command = command

		set.Set("profile", "some-profile")
	})

	Context("When the shell is not supported", func() {
		It("should error", func() {
			os.Setenv("SHELL", "not_supported_shell")
			Expect(BeforeDeactivateProfile(context)).Should(Equal(errors.New("Sorry, not_supported_shell is not a supported shell")))
		})
	})

	Context("When the resource file doesn't exist", func() {
		It("should error", func() {
			os.Setenv("SHELL", "/bin/bash")
			os.Setenv("HOME", "/tmp")