} }) It("executes the command in the specified namespace", func() { err := inNamespace.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(namespace.ExecuteCallCount()).To(Equal(1)) }) It("executes the command with the correct context", func() { err := inNamespace.Execute(context) Expect(err).NotTo(HaveOccurred()) Expect(command.ExecuteCallCount()).To(Equal(1)) Expect(command.ExecuteArgsForCall(0)).To(Equal(context)) }) Context("when namespace execute fails", func() { BeforeEach(func() { namespace.ExecuteReturns(errors.New("go away")) }) It("wraps and propagates the error", func() { err := inNamespace.Execute(context) Expect(err).To(MatchError("execute in namespace: go away")) }) }) Context("when the target command fails", func() { BeforeEach(func() {
It("executes a command with a context", func() { err := ex.Execute(command) Expect(err).NotTo(HaveOccurred()) Expect(command.ExecuteCallCount()).To(Equal(1)) }) Describe("Context", func() { var context executor.Context BeforeEach(func() { ex.Execute(command) Expect(command.ExecuteCallCount()).To(Equal(1)) context = command.ExecuteArgsForCall(0) }) Describe("AddressManager", func() { It("returns the address manager", func() { Expect(context.AddressManager()).To(Equal(addressManager)) }) }) Describe("LinkFactory", func() { It("returns the link factory", func() { Expect(context.LinkFactory()).To(Equal(linkFactory)) }) }) Describe("RouteManager", func() {