mock_redis 0.5.2 → 0.5.3

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.
@@ -1,3 +1,6 @@
1
+ ### 0.5.3
2
+ * Support `location` as an alias to `id` for `Sidekiq`'s benefit
3
+
1
4
  ### 0.5.2
2
5
  * Support `watch`
3
6
  * `sadd` is now Redis 2.4-compliant
@@ -40,6 +40,7 @@ class MockRedis
40
40
  def id
41
41
  "redis://#{self.host}:#{self.port}/#{self.db}"
42
42
  end
43
+ alias :location :id
43
44
 
44
45
  def call(command, &block)
45
46
  self.send(*command)
@@ -1,3 +1,3 @@
1
1
  class MockRedis
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -35,7 +35,7 @@ describe "#zrangebyscore(key, start, stop [:with_scores => true] [:limit => [off
35
35
 
36
36
  lambda do
37
37
  @redises.zrangebyscore(@key, -100, 100, :limit => "1, 2")
38
- end.should raise_error(RuntimeError)
38
+ end.should raise_error
39
39
  end
40
40
 
41
41
  it "treats scores like floats, not strings" do
@@ -40,7 +40,7 @@ describe "#zrevrangebyscore(key, start, stop [:with_scores => true] [:limit => [
40
40
 
41
41
  lambda do
42
42
  @redises.zrevrangebyscore(@key, 100, -100, :limit => "1, 2")
43
- end.should raise_error(RuntimeError)
43
+ end.should raise_error
44
44
  end
45
45
 
46
46
  it_should_behave_like "a zset-only command"
@@ -1,37 +1,32 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe MockRedis do
4
+ let(:url) { 'redis://127.0.0.1:6379/1' }
4
5
 
5
- context "with passed options" do
6
- before do
7
- @mock = MockRedis.new(:url => "redis://127.0.0.1:6379/1")
8
- end
6
+ describe '.new' do
7
+ subject { MockRedis.new(:url => url) }
9
8
 
10
- it "should correctly parse options" do
11
- @mock.host.should == "127.0.0.1"
12
- @mock.port.should == 6379
13
- @mock.db.should == 1
9
+ it 'correctly parses options' do
10
+ subject.host.should == '127.0.0.1'
11
+ subject.port.should == 6379
12
+ subject.db.should == 1
14
13
  end
15
14
 
16
- it "should have an id equal to redis url" do
17
- @mock.id.should == "redis://127.0.0.1:6379/1"
18
- end
15
+ its(:id) { should == url }
19
16
 
20
- context "when connecting to redis" do
21
- before do
22
- @mock = MockRedis.connect(:url => "redis://127.0.0.1:6379/0")
23
- end
17
+ its(:location) { should == url }
18
+ end
24
19
 
25
- it "should correctly parse options" do
26
- @mock.host.should == "127.0.0.1"
27
- @mock.port.should == 6379
28
- @mock.db.should == 0
29
- end
20
+ describe '.connect' do
21
+ let(:url) { 'redis://127.0.0.1:6379/0' }
22
+ subject { MockRedis.connect(:url => url) }
30
23
 
31
- it "should have an id equal to redis url" do
32
- @mock.id.should == "redis://127.0.0.1:6379/0"
33
- end
24
+ it 'correctly parses options' do
25
+ subject.host.should == '127.0.0.1'
26
+ subject.port.should == 6379
27
+ subject.db.should == 0
34
28
  end
35
- end
36
29
 
30
+ its(:id) { should == url }
31
+ end
37
32
  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.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-18 00:00:00.000000000 Z
13
+ date: 2012-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake