Expect(repo.InstanceCount()).To(Equal(3))
			})
		})
	})

	Describe("#PersistStatefile", func() {
		BeforeEach(func() {
			err := repo.Create("foo")
			Expect(err).ToNot(HaveOccurred())

			_, err = repo.Bind("foo", "foo-binding")
			Expect(err).ToNot(HaveOccurred())
		})

		It("writes state to a file", func() {
			err := repo.PersistStatefile()
			Expect(err).ToNot(HaveOccurred())

			statefileContents := getStatefileContents(statefilePath)

			Expect(len(statefileContents.AvailableInstances)).To(Equal(2))
			Expect(len(statefileContents.AllocatedInstances)).To(Equal(1))

			allocatedInstance := statefileContents.AllocatedInstances[0]
			Expect(allocatedInstance.Host).To(Equal("10.0.0.1"))

			Expect(len(statefileContents.InstanceBindings["foo"])).To(Equal(1))
			Expect(statefileContents.InstanceBindings["foo"][0]).To(Equal("foo-binding"))
		})
	})