_, _, err := lockPool.RemoveLock(lockDir) Ω(err).Should(HaveOccurred()) }) }) Context("when setup succeeds", func() { It("tries to reset the lock state", func() { _, _, err := lockPool.RemoveLock(lockDir) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeLockHandler.ResetLockCallCount()).Should(Equal(1)) }) Context("when resetting the lock state fails", func() { BeforeEach(func() { fakeLockHandler.ResetLockReturns(errors.New("some-error")) }) It("returns an error", func() { _, _, err := lockPool.RemoveLock(lockDir) Ω(err).Should(HaveOccurred()) }) }) Context("when resetting the lock state succeeds", func() { It("tries to remove the lock it found in the name file", func() { _, _, err := lockPool.RemoveLock(lockDir) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeLockHandler.RemoveLockCallCount()).Should(Equal(1)) lockName := fakeLockHandler.RemoveLockArgsForCall(0)