コード例 #1
0
				fakeLocalRepository.FindByIDReturns(
					&redis.Instance{
						ID: instanceID,
					},
					nil,
				)
			})

			JustBeforeEach(func() {
				err := localInstanceCreator.Destroy(instanceID)
				Expect(err).NotTo(HaveOccurred())
			})

			It("calls lock before stopping redis", func() {
				Expect(fakeLocalRepository.LockCallCount()).To(Equal(1))
				Expect(fakeLocalRepository.LockArgsForCall(0).ID).To(Equal(instanceID))
			})

			It("kills the instance", func() {
				Ω(len(fakeProcessController.KilledInstances)).To(Equal(1))
				Ω(fakeProcessController.KilledInstances[0].ID).To(Equal(instanceID))
			})

			It("deletes the instance data directory", func() {
				Expect(fakeLocalRepository.DeleteCallCount()).To(Equal(1))
				Expect(fakeLocalRepository.DeleteArgsForCall(0)).To(Equal(instanceID))
			})
		})

		Context("When the instance does not exist", func() {
			var destroyErr error