Skip to content

Conversation

@jdelStrother
Copy link
Contributor

Previously call(:info) would fail:

> MockRedis.new.call :info
(foo):3 in '<main>': undefined method 'i' for an instance of MockRedis::Database (NoMethodError)
  public_send(command[0].downcase, *command[1..])

I fixed that by flattening the arguments passed to Database#call ... but noticed that actually, call(:info) ought to return a raw string rather than a parsed hash. How about something like this?

Previously this would fail with -

```
NoMethodError: undefined method 'i' for an instance of MockRedis::Database
mock_redis-0.52.0/lib/mock_redis/database.rb:58:in 'Kernel#public_send'
mock_redis-0.52.0/lib/mock_redis/database.rb:58:in 'MockRedis::Database#call'
mock_redis-0.52.0/lib/mock_redis/multi_db_wrapper.rb:21:in 'MockRedis::MultiDbWrapper#method_missing'
mock_redis-0.52.0/lib/mock_redis/expire_wrapper.rb:17:in 'MockRedis::ExpireWrapper#method_missing'
mock_redis-0.52.0/lib/mock_redis/transaction_wrapper.rb:25:in 'MockRedis::TransactionWrapper#method_missing'
mock_redis-0.52.0/lib/mock_redis/pipelined_wrapper.rb:27:in 'MockRedis::PipelinedWrapper#method_missing'
mock_redis-0.52.0/lib/mock_redis.rb:95:in 'block in MockRedis#method_missing'
mock_redis-0.52.0/lib/mock_redis.rb:151:in 'MockRedis#logging'
mock_redis-0.52.0/lib/mock_redis.rb:94:in 'MockRedis#method_missing'
```

I've updated the way `call` handles its arguments, to just flatten them into a single array regardless of length.
In redis-rb:
- redis.info() returns a parsed Hash
- redis.call("info") returns a raw string

I've added a info_raw method, and updated `call` to use it for info commands.
@sds sds added the bug label Nov 7, 2025
@sds sds merged commit a8456c2 into sds:main Nov 7, 2025
11 checks passed
@sds
Copy link
Owner

sds commented Nov 7, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants