Describe("#Bind", func() {
			BeforeEach(func() {
				fakeAgentClient.CredentialsFunc = func(rootURL string) (redis.Credentials, error) {
					if rootURL == "https://10.0.0.1:1234" {
						return redis.Credentials{
							Port:     123456,
							Password: "******",
						}, nil
					} else {
						return redis.Credentials{}, errors.New("wrong url")
					}
				}
			})

			It("returns the instance information", func() {
				instanceCredentials, err := repo.Bind("foo", "foo-binding")
				Expect(err).ToNot(HaveOccurred())
				Expect(instanceCredentials.Host).To(Equal("10.0.0.1"))
				Expect(instanceCredentials.Port).To(Equal(123456))
				Expect(instanceCredentials.Password).To(Equal("super-secret"))
			})

			It("writes the new state to the statefile", func() {
				_, err := repo.Bind("foo", "foo-binding")
				Expect(err).ToNot(HaveOccurred())

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