Describe("Run", func() {
		It("tries to find disk with given disk cid", func() {
			_, err := action.Run(1234)
			Expect(err).ToNot(HaveOccurred())

			Expect(diskFinder.FindID).To(Equal(1234))
		})

		Context("when disk is found with given disk cid", func() {
			var (
				disk *fakedisk.FakeDisk
			)

			BeforeEach(func() {
				disk = fakedisk.NewFakeDisk(1234)
				diskFinder.FindDisk = disk
				diskFinder.FindFound = true
			})

			It("deletes disk", func() {
				_, err := action.Run(1234)
				Expect(err).ToNot(HaveOccurred())

				Expect(disk.DeleteCalled).To(BeTrue())
			})

			It("returns error if deleting disk fails", func() {
				disk.DeleteErr = errors.New("fake-delete-err")

				_, err := action.Run(1234)
				Expect(err).To(HaveOccurred())
		action     DetachDisk
	)

	BeforeEach(func() {
		vmFinder = &fakevm.FakeFinder{}
		diskFinder = &fakedisk.FakeFinder{}
		action = NewDetachDisk(vmFinder, diskFinder)
	})

	Describe("Run", func() {
		It("tries to find VM with given VM cid", func() {
			vmFinder.FindFound = true
			vmFinder.FindVM = fakevm.NewFakeVM(1234)

			diskFinder.FindFound = true
			diskFinder.FindDisk = fakedisk.NewFakeDisk(1234)

			_, err := action.Run(1234, 1234)
			Expect(err).ToNot(HaveOccurred())

			Expect(vmFinder.FindID).To(Equal(1234))
		})

		Context("when VM is found with given VM cid", func() {
			var (
				vm *fakevm.FakeVM
			)

			BeforeEach(func() {
				vm = fakevm.NewFakeVM(1234)
				vmFinder.FindVM = vm