elliotchance / redismock

🕋 Mocking Redis in unit tests in Go.
MIT License
147 stars 24 forks source link

Adding redis v7 support #17

Closed haakonmo closed 4 years ago

haakonmo commented 4 years ago

Usage

import (
    "github.com/alicebob/miniredis"
    redis "github.com/go-redis/redis/v7"
    "github.com/elliotchance/redismock/v7"
)

func newTestRedis() *redismock.ClientMock {
    mr, err := miniredis.Run()
    if err != nil {
        panic(err)
    }
    client := redis.NewClient(&redis.Options{
        Addr: mr.Addr(),
    })
    return redismock.NewNiceMock(client)
}

This change is Reviewable