nest 1.0.1 → 1.0.2

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.
Files changed (4) hide show
  1. data/lib/nest.rb +2 -2
  2. data/nest.gemspec +2 -2
  3. data/test/nest_test.rb +24 -0
  4. metadata +4 -4
@@ -1,7 +1,7 @@
1
1
  require "redis"
2
2
 
3
3
  class Nest < String
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
 
6
6
  METHODS = [:append, :blpop, :brpop, :decr, :decrby, :del, :exists,
7
7
  :expire, :expireat, :get, :getset, :hdel, :hexists, :hget, :hgetall,
@@ -19,7 +19,7 @@ class Nest < String
19
19
 
20
20
  attr :redis
21
21
 
22
- def initialize(key, redis = Redis.connect)
22
+ def initialize(key, redis = Redis.current)
23
23
  super(key.to_s)
24
24
  @redis = redis
25
25
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nest"
3
- s.version = "1.0.1"
4
- s.summary = "Object Oriented Keys for Redis."
3
+ s.version = "1.0.2"
4
+ s.summary = "Object-oriented keys for Redis."
5
5
  s.description = "It is a design pattern in key-value databases to use the key to simulate structure, and Nest can take care of that."
6
6
  s.authors = ["Michel Martens"]
7
7
  s.email = ["michel@soveran.com"]
@@ -84,3 +84,27 @@ scope do
84
84
  assert message_received
85
85
  end
86
86
  end
87
+
88
+ scope do
89
+ prepare do
90
+ @redis1 = Redis.connect(:db => 15)
91
+ @redis2 = Redis.connect(:db => 14)
92
+
93
+ @redis1.flushdb
94
+ @redis2.flushdb
95
+ end
96
+
97
+ test "honors Redis.current" do
98
+ Redis.current = @redis1
99
+
100
+ foo = Nest.new("foo")
101
+
102
+ foo.set("bar")
103
+
104
+ assert_equal "bar", foo.get
105
+
106
+ Redis.current = @redis2
107
+
108
+ assert_equal nil, Nest.new("foo").get
109
+ end
110
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michel Martens
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-05 00:00:00 -03:00
17
+ date: 2010-12-27 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -93,6 +93,6 @@ rubyforge_project:
93
93
  rubygems_version: 1.3.7
94
94
  signing_key:
95
95
  specification_version: 3
96
- summary: Object Oriented Keys for Redis.
96
+ summary: Object-oriented keys for Redis.
97
97
  test_files: []
98
98