@@ -9,62 +9,62 @@ describe Cache do
99
1010 context " #initialize" do
1111 it " initialize" do
12- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours)
12+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours)
1313
14- store.should be_a(Cache ::RedisCacheStore (String , String ))
14+ store.should be_a(Cache ::RedisCacheStore (String ))
1515 end
1616
1717 it " initialize with Redis::Client" do
1818 redis_uri = URI .parse(" redis://localhost:6379/1" )
1919 redis = Redis ::Client .new(uri: redis_uri)
20- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours, cache: redis)
20+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours, cache: redis)
2121
22- store.should be_a(Cache ::RedisCacheStore (String , String ))
22+ store.should be_a(Cache ::RedisCacheStore (String ))
2323 end
2424 end
2525
2626 context " instance methods" do
2727 it " #inspect without namescape" do
28- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours)
28+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours)
2929
3030 store.inspect.should match(
31- /\A #<Cache\:\: RedisCacheStore\( String, String \) redis=#<Redis\:\: Client\: 0x.*expires_in=12:00:00.*namespace=nil>\z /
31+ /\A #<Cache\:\: RedisCacheStore\( String\) redis=#<Redis\:\: Client\: 0x.*expires_in=12:00:00.*namespace=nil>\z /
3232 )
3333 end
3434
3535 it " #inspect with namescape" do
36- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours, namespace: " myapp-cache" )
36+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours, namespace: " myapp-cache" )
3737
3838 store.inspect.should match(
39- /\A #<Cache\:\: RedisCacheStore\( String, String \) redis=#<Redis\:\: Client\: 0x.*expires_in=12:00:00.*namespace=\" myapp-cache\" >\z /
39+ /\A #<Cache\:\: RedisCacheStore\( String\) redis=#<Redis\:\: Client\: 0x.*expires_in=12:00:00.*namespace=\" myapp-cache\" >\z /
4040 )
4141 end
4242
4343 it " #redis" do
44- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours)
44+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours)
4545 store.redis.should be_a(Redis ::Client )
4646 end
4747
4848 it " #expires_in" do
49- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours)
49+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours)
5050 store.expires_in.should eq(12 .hours)
5151 end
5252
5353 it " #namespace" do
54- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours, namespace: " myapp-cache" )
54+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours, namespace: " myapp-cache" )
5555 store.namespace.should eq(" myapp-cache" )
5656 end
5757 end
5858
5959 it " write to cache first time" do
60- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
60+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
6161
6262 value = store.fetch(" foo" ) { " bar" }
6363 value.should eq(" bar" )
6464 end
6565
6666 it " fetch from cache" do
67- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
67+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
6868
6969 value = store.fetch(" foo" ) { " bar" }
7070 value.should eq(" bar" )
@@ -76,7 +76,7 @@ describe Cache do
7676 it " fetch from cache with custom Redis::Client" do
7777 redis_uri = URI .parse(" redis://localhost:6379/1" )
7878 redis = Redis ::Client .new(uri: redis_uri)
79- store = Cache ::RedisCacheStore (String , String ).new(expires_in: 12 .hours, cache: redis)
79+ store = Cache ::RedisCacheStore (String ).new(expires_in: 12 .hours, cache: redis)
8080
8181 value = store.fetch(" foo" ) { " bar" }
8282 value.should eq(" bar" )
@@ -86,7 +86,7 @@ describe Cache do
8686 end
8787
8888 it " don't fetch from cache if expired" do
89- store = Cache ::RedisCacheStore (String , String ).new(1 .seconds)
89+ store = Cache ::RedisCacheStore (String ).new(1 .seconds)
9090
9191 value = store.fetch(" foo" ) { " bar" }
9292 value.should eq(" bar" )
@@ -98,7 +98,7 @@ describe Cache do
9898 end
9999
100100 it " fetch with expires_in from cache" do
101- store = Cache ::RedisCacheStore (String , String ).new(1 .seconds)
101+ store = Cache ::RedisCacheStore (String ).new(1 .seconds)
102102
103103 value = store.fetch(" foo" , expires_in: 1 .hours) { " bar" }
104104 value.should eq(" bar" )
@@ -110,7 +110,7 @@ describe Cache do
110110 end
111111
112112 it " don't fetch with expires_in from cache if expires" do
113- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
113+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
114114
115115 value = store.fetch(" foo" , expires_in: 1 .seconds) { " bar" }
116116 value.should eq(" bar" )
@@ -122,15 +122,15 @@ describe Cache do
122122 end
123123
124124 it " write" do
125- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
125+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
126126 store.write(" foo" , " bar" , expires_in: 1 .minute)
127127
128128 value = store.fetch(" foo" ) { " bar" }
129129 value.should eq(" bar" )
130130 end
131131
132132 it " rewrite value" do
133- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
133+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
134134 store.write(" foo" , " bar" , expires_in: 1 .minute)
135135 store.write(" foo" , " baz" , expires_in: 1 .minute)
136136
@@ -139,15 +139,15 @@ describe Cache do
139139 end
140140
141141 it " read" do
142- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
142+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
143143 store.write(" foo" , " bar" )
144144
145145 value = store.read(" foo" )
146146 value.should eq(" bar" )
147147 end
148148
149149 it " set a custom expires_in value for entry on write" do
150- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
150+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
151151 store.write(" foo" , " bar" , expires_in: 1 .second)
152152
153153 store.keys.should eq(Set {" foo" })
@@ -161,7 +161,7 @@ describe Cache do
161161 end
162162
163163 it " delete from cache" do
164- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
164+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
165165
166166 value = store.fetch(" foo" ) { " bar" }
167167 value.should eq(" bar" )
@@ -175,7 +175,7 @@ describe Cache do
175175 end
176176
177177 it " deletes all items from the cache" do
178- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
178+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
179179
180180 value = store.fetch(" foo" ) { " bar" }
181181 value.should eq(" bar" )
@@ -188,7 +188,7 @@ describe Cache do
188188 end
189189
190190 it " #exists?" do
191- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
191+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
192192
193193 store.write(" foo" , " bar" )
194194
@@ -197,7 +197,7 @@ describe Cache do
197197 end
198198
199199 it " #exists? expires" do
200- store = Cache ::RedisCacheStore (String , String ).new(1 .second)
200+ store = Cache ::RedisCacheStore (String ).new(1 .second)
201201
202202 store.write(" foo" , " bar" )
203203
@@ -207,7 +207,7 @@ describe Cache do
207207 end
208208
209209 it " #increment" do
210- store = Cache ::RedisCacheStore (String , Int32 ).new(12 .hours)
210+ store = Cache ::RedisCacheStore (Int32 ).new(12 .hours)
211211
212212 store.write(" num" , 1 )
213213 store.increment(" num" , 1 )
@@ -218,7 +218,7 @@ describe Cache do
218218 end
219219
220220 it " #decrement" do
221- store = Cache ::RedisCacheStore (String , Int32 ).new(12 .hours)
221+ store = Cache ::RedisCacheStore (Int32 ).new(12 .hours)
222222
223223 store.write(" num" , 2 )
224224 store.decrement(" num" , 1 )
@@ -229,7 +229,7 @@ describe Cache do
229229 end
230230
231231 it " #increment non-existent value" do
232- store = Cache ::RedisCacheStore (String , Int32 ).new(12 .hours)
232+ store = Cache ::RedisCacheStore (Int32 ).new(12 .hours)
233233
234234 store.increment(" undef_num" , 1 )
235235
@@ -239,7 +239,7 @@ describe Cache do
239239 end
240240
241241 it " clear" do
242- store = Cache ::RedisCacheStore (String , String ).new(12 .hours)
242+ store = Cache ::RedisCacheStore (String ).new(12 .hours)
243243
244244 store.write(" foo" , " bar" , expires_in: 1 .minute)
245245
@@ -251,10 +251,10 @@ describe Cache do
251251
252252 context " with namespace" do
253253 it " write" do
254- store1 = Cache ::RedisCacheStore (String , String ).new(12 .hours, namespace: " myapp-cache" )
254+ store1 = Cache ::RedisCacheStore (String ).new(12 .hours, namespace: " myapp-cache" )
255255 store1 .write(" foo1" , " bar" , expires_in: 1 .minute)
256256
257- store2 = Cache ::RedisCacheStore (String , String ).new(12 .hours)
257+ store2 = Cache ::RedisCacheStore (String ).new(12 .hours)
258258 store2 .write(" foo1" , " baz" , expires_in: 1 .minute)
259259
260260 store1 .keys.should eq(Set {" foo1" })
@@ -265,8 +265,8 @@ describe Cache do
265265 end
266266
267267 it " clear" do
268- store = Cache ::RedisCacheStore (String , String ).new(12 .hours, namespace: " myapp-cache" )
269- other_store = Cache ::RedisCacheStore (String , String ).new(12 .hours, namespace: " other-cache" )
268+ store = Cache ::RedisCacheStore (String ).new(12 .hours, namespace: " myapp-cache" )
269+ other_store = Cache ::RedisCacheStore (String ).new(12 .hours, namespace: " other-cache" )
270270
271271 1001 .times do |i |
272272 store.write(" #{ i + 1 } " , " bar" , expires_in: 1 .minute)
0 commit comments