-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
expire
-related command options nx
, xx
, lt
and…
… `gt` (#290) Resolves #286 I also addes some specs to run against redis 7. Some of the existing specs fail, so I marked new specs with `redis: 7.0` tag. Running `bundle exec rspec --tag redis:7.0` should run only redis-7-related specs, and running with `redis:6.2` or without tag at all should run all the specs except of redis-7-related. Not sure if this is an appropriate/optimal solution
- Loading branch information
1 parent
d1e02a1
commit fe097a6
Showing
8 changed files
with
188 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
spec/support/shared_examples/raises_on_invalid_expire_command_options.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
RSpec.shared_examples_for 'raises on invalid expire command options' do |command| | ||
[%i[nx xx], %i[nx lt], %i[nx gt], %i[lt gt]].each do |options| | ||
context "with `#{options[0]}` and `#{options[1]}` options" do | ||
it 'raises `Redis::CommandError`' do | ||
expect { @mock.public_send(command, @key, 1, **options.zip([true, true]).to_h) } | ||
.to raise_error( | ||
Redis::CommandError, | ||
'ERR NX and XX, GT or LT options at the same time are not compatible' | ||
) | ||
end | ||
end | ||
|
||
context 'with unexpected key' do | ||
it 'raises `ArgumentError`' do | ||
expect { @mock.public_send(command, @key, 1, foo: true) } | ||
.to raise_error(ArgumentError) | ||
end | ||
end | ||
end | ||
end |