mock_redis 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85e71d6b9f2fa3400db015c2c29a7f8c0d017c1c6c0f44f45c404fd1eb8d6fd6
4
- data.tar.gz: b61b3a420aa7dc9232fffbddd263c82719665cc738e1e36834d95fcd9566cff3
3
+ metadata.gz: ac517fcc81e569da0e5e0512027dd381ebd8c0553aaa9aa373ffb7be3afe983e
4
+ data.tar.gz: 5e64b3ac11ab9c403165c082b8c2db641858ffd7430a6f6fd1c3c88c1d7b7090
5
5
  SHA512:
6
- metadata.gz: ce57715bda59804aeed319d49a76d81ac9cd1e4d9093005402dd256b804b20245c2a723051eef79c7da883896e75b72b91fe0066ae6e830dd1d24130a751b965
7
- data.tar.gz: b4a4d237d9705b64b973fd5959ed2544fd8fbf037f5525b1080d647c1b4a1743fb22110e8d5af4cf4077ba7a185e880f4cfbb303ff23346db3611adc64d5aab3
6
+ metadata.gz: c4ab0e03ac161be256d4920837fe1cc70da6ae57f29b4e75c1f2eec404b46ad2efa5679552b089eddd3234d49eb85a8ec0f1a51cbfa118654da31a0c43f4c7cb
7
+ data.tar.gz: 8c97fae25f874bdbbaedd52e0ac10bd793fae3cb711e7e6a368147301fbc653a35d0630e9c0ae172cc625b2b9c4f266d9d7dd08fe92441cfc5e04156d98a1ebd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.35.0
4
+
5
+ * Add support for `getdel`
6
+
3
7
  ### 0.34.0
4
8
 
5
9
  * Add support for `with`
@@ -107,6 +107,12 @@ class MockRedis
107
107
  end
108
108
  end
109
109
 
110
+ def getdel(key)
111
+ value = get(key)
112
+ del(key)
113
+ value
114
+ end
115
+
110
116
  def getrange(key, start, stop)
111
117
  assert_stringy(key)
112
118
  (data[key] || '')[start..stop]
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.34.0'
5
+ VERSION = '0.35.0'
6
6
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe '#getdel(key)' do
4
+ before do
5
+ @key = 'mock-redis-test:73288'
6
+ end
7
+
8
+ it 'returns nil for a nonexistent value' do
9
+ @redises.getdel('mock-redis-test:does-not-exist').should be_nil
10
+ end
11
+
12
+ it 'returns a stored string value' do
13
+ @redises.set(@key, 'forsooth')
14
+ @redises.getdel(@key).should == 'forsooth'
15
+ end
16
+
17
+ it 'deletes the key after returning it' do
18
+ @redises.set(@key, 'forsooth')
19
+ @redises.getdel(@key)
20
+ @redises.get(@key).should be_nil
21
+ end
22
+
23
+ it_should_behave_like 'a string-only command'
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mock_redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.0
4
+ version: 0.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-19 00:00:00.000000000 Z
12
+ date: 2022-12-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby2_keywords
@@ -164,6 +164,7 @@ files:
164
164
  - spec/commands/geopos_spec.rb
165
165
  - spec/commands/get_spec.rb
166
166
  - spec/commands/getbit_spec.rb
167
+ - spec/commands/getdel.rb
167
168
  - spec/commands/getrange_spec.rb
168
169
  - spec/commands/getset_spec.rb
169
170
  - spec/commands/hdel_spec.rb
@@ -351,6 +352,7 @@ test_files:
351
352
  - spec/commands/geopos_spec.rb
352
353
  - spec/commands/get_spec.rb
353
354
  - spec/commands/getbit_spec.rb
355
+ - spec/commands/getdel.rb
354
356
  - spec/commands/getrange_spec.rb
355
357
  - spec/commands/getset_spec.rb
356
358
  - spec/commands/hdel_spec.rb