Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keys are not consistently converted to strings #217

Closed
clemens opened this issue Oct 25, 2021 · 1 comment
Closed

Keys are not consistently converted to strings #217

clemens opened this issue Oct 25, 2021 · 1 comment
Labels
bug contributions-welcome Contributions from anyone are welcome

Comments

@clemens
Copy link

clemens commented Oct 25, 2021

Follow-up of #170.

The issue mentioned there also applies to other data types:

  • sets
  • sorted sets
  • lists
  • partially strings (e.g. incr, incrby, decr, decrby)
  • presumably streams (haven't tested it, but the code looks like it)

Reproducible like so:

# assuming REDIS is an instance of MockRedis
irb(main):001:0> REDIS.sadd(:foo, [1, 2])
=> 2
irb(main):002:0> REDIS.zadd(:bar, [1, 2])
=> 1
irb(main):003:0> REDIS.keys
=> [:foo, :bar]
irb(main):004:0> REDIS.flushdb
=> "OK"
irb(main):005:0> REDIS.keys
=> [:foo, :bar]

It seems that pretty much everything except hashes (which were fixed in #173) and set are broken this way.

Proposed solution:

  • extract a convert(key) utility method and wrap each usage of keys
  • add a separate spec file that test each supported method with string and symbol keys OR add example to each single file
@sds sds added contributions-welcome Contributions from anyone are welcome bug labels Feb 17, 2022
@sds
Copy link
Owner

sds commented Jan 25, 2024

Open to a pull request addressing this issue.

@sds sds closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug contributions-welcome Contributions from anyone are welcome
Projects
None yet
Development

No branches or pull requests

2 participants