Exemplo n.º 1
0
		})
	})

	Describe("#Get", func() {
		It("calls GET on the redis connection", func() {
			var getCalled bool
			fakeConnection.RespondToDo(func(command string, args ...interface{}) (interface{}, error) {
				getCalled = true
				Expect(command).To(Equal("GET"))
				Expect(args[0]).To(HaveLen(1))
				Expect(args[0].([]interface{})[0]).To(Equal("my key"))

				return int64(42), nil
			})

			val, err := commander.Get("my key")
			Expect(err).To(BeNil())
			Expect(getCalled).To(BeTrue())

			myNum, err := redis.Int(val, err)
			Expect(myNum).To(Equal(42))
			Expect(err).To(BeNil())
		})
	})

	Describe("#GetInt", func() {
		It("calls GET on the redis connection and returns an int", func() {
			var getIntCalled bool
			fakeConnection.RespondToDo(func(command string, args ...interface{}) (interface{}, error) {
				getIntCalled = true
				Expect(command).To(Equal("GET"))