Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change exists return and add exists? (#188)
* Change exists return and add exists? * Bump redis version * Fix usage of exists and specs * Change xadd error message * Address rubocop * Rubocop
- Loading branch information
Showing
20 changed files
with
105 additions
and
53 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,43 @@ | ||
require 'spec_helper' | ||
|
||
describe '#exists(key)' do | ||
before { @key = 'mock-redis-test:45794' } | ||
describe '#exists(*keys)' do | ||
before { @key1 = 'mock-redis-test:exists1' } | ||
before { @key2 = 'mock-redis-test:exists2' } | ||
|
||
it 'returns 0 for keys that do not exist' do | ||
@redises.exists(@key1).should == 0 | ||
@redises.exists(@key1, @key2).should == 0 | ||
end | ||
|
||
it 'returns 1 for keys that do exist' do | ||
@redises.set(@key1, 1) | ||
@redises.exists(@key1).should == 1 | ||
end | ||
|
||
it 'returns the count of all keys that exist' do | ||
@redises.set(@key1, 1) | ||
@redises.set(@key2, 1) | ||
@redises.exists(@key1, @key2).should == 2 | ||
@redises.exists(@key1, @key2, 'does-not-exist').should == 2 | ||
end | ||
end | ||
|
||
describe '#exists?(*keys)' do | ||
before { @key1 = 'mock-redis-test:exists1' } | ||
before { @key2 = 'mock-redis-test:exists2' } | ||
|
||
it 'returns false for keys that do not exist' do | ||
@redises.exists(@key).should == false | ||
@redises.exists?(@key1).should == false | ||
@redises.exists?(@key1, @key2).should == false | ||
end | ||
|
||
it 'returns true for keys that do exist' do | ||
@redises.set(@key, 1) | ||
@redises.exists(@key).should == true | ||
@redises.set(@key1, 1) | ||
@redises.exists?(@key1).should == true | ||
end | ||
|
||
it 'returns true if any keys exist' do | ||
@redises.set(@key2, 1) | ||
@redises.exists?(@key1, @key2).should == true | ||
end | ||
end |
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
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
Oops, something went wrong.