Ω(freePortsFound).To(Equal(1)) }) It("starts a new Redis instance", func() { err := localInstanceCreator.Create(instanceID) Ω(err).ToNot(HaveOccurred()) Ω(len(fakeProcessController.StartedInstances)).To(Equal(1)) Ω(fakeProcessController.StartedInstances[0].ID).To(Equal(instanceID)) }) It("calls Unlock on local repository with correct instance ID", func() { err := localInstanceCreator.Create(instanceID) Expect(err).ShouldNot(HaveOccurred()) Expect(fakeLocalRepository.UnlockCallCount()).To(Equal(1)) Expect(fakeLocalRepository.UnlockArgsForCall(0).ID).To(Equal(instanceID)) }) }) Context("when the service instance limit has been met", func() { BeforeEach(func() { fakeLocalRepository.InstanceCountReturns(1, []error{}) }) It("does not start a new Redis instance", func() { localInstanceCreator.Create(instanceID) Ω(len(fakeProcessController.StartedInstances)).To(Equal(0)) })