Exemple #1
0
		})
	})

	Describe("Destroy", func() {
		It("sends a destroy request", func() {
			err := client.Destroy("some-handle")
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.DestroyArgsForCall(0)).Should(Equal("some-handle"))
		})

		Context("when there is a connection error", func() {
			disaster := errors.New("oh no!")

			BeforeEach(func() {
				fakeConnection.DestroyReturns(disaster)
			})

			It("returns it", func() {
				err := client.Destroy("some-handle")
				Ω(err).Should(Equal(disaster))
			})
		})

		Context("when the error is a 404", func() {
			notFound := connection.Error{404, ""}

			BeforeEach(func() {
				fakeConnection.DestroyReturns(notFound)
			})
Exemple #2
0
		})
	})

	Describe("Destroy", func() {
		It("sends a destroy request", func() {
			err := client.Destroy("some-handle")
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.DestroyArgsForCall(0)).Should(Equal("some-handle"))
		})

		Context("when there is a connection error", func() {
			disaster := errors.New("oh no!")

			BeforeEach(func() {
				fakeConnection.DestroyReturns(disaster)
			})

			It("returns it", func() {
				err := client.Destroy("some-handle")
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Describe("Lookup", func() {
		It("sends a list request", func() {
			fakeConnection.ListReturns([]string{"some-handle", "some-other-handle"}, nil)

			container, err := client.Lookup("some-handle")
			Ω(err).ShouldNot(HaveOccurred())
				Ω(calledSpec).Should(Equal(spec))
			})

			It("returns the container handle", func() {
				Ω(gotHandle).Should(Equal("bach"))
			})
		})
	})

	Describe("Destroy", func() {
		handle := "mozart"

		itRetries(func() error {
			return conn.Destroy(handle)
		}, func(err error) {
			innerConnection.DestroyReturns(err)
		}, func() int {
			return innerConnection.DestroyCallCount()
		}, func() {
			It("calls through to garden", func() {
				Ω(innerConnection.DestroyCallCount()).Should(Equal(1))

				calledHandle := innerConnection.DestroyArgsForCall(0)
				Ω(calledHandle).Should(Equal(handle))
			})
		})
	})

	Describe("Property", func() {
		handle := "suitcase"
		property := "dfghjkl"