Understand MockRedis limitations and exceptions
mainBecause MockRedis is an in-memory object confined to a single Ruby process, it behaves differently than a real Redis server in several ways:
Blocking List Commands
Commands like #blmove, #blpop, #brpop, and #brpoplpush work normally if data is available. However:
- If a nonzero timeout is used and no data is available, the command returns immediately.
- If a 0 timeout (wait forever) is used and no data is available, a
MockRedis::WouldBlockexception is raised to prevent the test from hanging indefinitely.
Command Behavior Differences
#info: Returns canned values that do not update over time.#sort: SupportsASCandDESCsorting, butALPHAsort is not supported.#config: Methods like:get,:set, and:resetstatare not yet implemented and return canned values.