BeforeEach(func() { vm = fakevm.NewFakeVM(1234) vmFinder.FindVM = vm vmFinder.FindFound = true }) It("configures vm networks", func() { _, err := action.Run(1234, networks) Expect(err).ToNot(HaveOccurred()) Expect(vm.ConfigureNetworksCalled).To(BeTrue()) Expect(vm.Networks).To(Equal(networks.AsVMNetworks())) }) It("returns error if configure networks fails", func() { vm.ConfigureNetworksErr = errors.New("fake-configure-networks-err") _, err := action.Run(1234, networks) Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("fake-configure-networks-err")) }) }) Context("when vm is not found with given cid", func() { It("does vmFinder return error", func() { vmFinder.FindFound = false _, err := action.Run(1234, networks) Expect(err).ToNot(HaveOccurred()) }) })