Beispiel #1
0
		Expect(val).To(BeTrue())
	})

	Context("when retrieving the Space fails", func() {
		BeforeEach(func() {
			fakeSpaceFactory.GetReturns(space.Space{}, errors.New("get failed"))
		})

		It("returns an err", func() {
			err := cmd.AllowSSH([]string{"allow-space-ssh", "myspace"}, fakeSpaceFactory)
			Expect(err).To(MatchError("get failed"))
			Expect(fakeSpaceFactory.GetCallCount()).To(Equal(1))
			Expect(fakeSpaceFactory.SetBoolCallCount()).To(Equal(0))
		})
	})

	Context("when setting the value fails", func() {
		BeforeEach(func() {
			fakeSpaceFactory.GetReturns(mySpace, nil)
			fakeSpaceFactory.SetBoolReturns(errors.New("set failed"))
		})

		It("returns an err", func() {
			err := cmd.AllowSSH([]string{"allow-space-ssh", "myspace"}, fakeSpaceFactory)
			Expect(err).To(MatchError("set failed"))
			Expect(fakeSpaceFactory.GetCallCount()).To(Equal(1))
			Expect(fakeSpaceFactory.SetBoolCallCount()).To(Equal(1))
		})
	})
})