Context("when it cannot persist the state to the state file", func() {
				BeforeEach(func() {
					os.Remove(statefilePath)
					os.Mkdir(statefilePath, 0644)
				})

				AfterEach(func() {
					os.RemoveAll(statefilePath)
				})

				It("does not allocate an instance", func() {
					err := repo.Create("bar")
					Expect(err).To(HaveOccurred())

					_, err = repo.FindByID("bar")
					Expect(err).To(HaveOccurred())
				})
			})

			Context("when the instanceID is already allocated", func() {
				It("returns brokerapi.ErrInstanceAlreadyExists", func() {
					err := repo.Create("foo")
					Expect(err).To(HaveOccurred())
					Expect(err).To(Equal(brokerapi.ErrInstanceAlreadyExists))
				})
			})

			Context("when instance capacity has been reached", func() {
				BeforeEach(func() {
					repo.Create("bar")