コード例 #1
0
		}
	})

	It("gets the sandbox from the repository", func() {
		err := moveLink.Execute(context)
		Expect(err).NotTo(HaveOccurred())

		Expect(sandboxRepository.GetCallCount()).To(Equal(1))
		Expect(sandboxRepository.GetArgsForCall(0)).To(Equal("sandbox-name"))
	})

	It("moves the link to the target namespace", func() {
		err := moveLink.Execute(context)
		Expect(err).NotTo(HaveOccurred())

		Expect(linkFactory.SetNamespaceCallCount()).To(Equal(1))
		name, fd := linkFactory.SetNamespaceArgsForCall(0)
		Expect(name).To(Equal("link-name"))
		Expect(fd).To(BeEquivalentTo(999))
	})

	Context("when getting the sandbox fails", func() {
		BeforeEach(func() {
			sandboxRepository.GetReturns(nil, errors.New("welp"))
		})

		It("returns a meaningful error", func() {
			err := moveLink.Execute(context)
			Expect(err).To(MatchError("get sandbox: welp"))
		})
	})