cached_resource 2.3.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7a2fced4f0e8dbfadcb40561224f9edf2d6e86e
4
- data.tar.gz: bc219a0630f7f8775f26b809715e810fffd0eda7
3
+ metadata.gz: a93c586d68149afe39b531b4fa7b9230a1ad71f5
4
+ data.tar.gz: 66c08229d6334ebd4f79d771a70d26fa3d82c495
5
5
  SHA512:
6
- metadata.gz: 1bad23ceba36ea99cf5e740ebfb4f730e8ca89a72fda08920f5fe39a68d81289adda8efed286b80144a833ce3d11ce95bcb1a5969a049a1ffed3a57be36c1870
7
- data.tar.gz: b82d25319734c6cfb9d3bbebf0c7daf5d234a516bfa5a0612e3b9feb9b16f5b2e7ff6fb71178340a8e46d3eb36b55aef3db736b98fa74c2eb4774d60808925be
6
+ metadata.gz: 84c687552fa91f2bcd6384e01f63b1682b086442d57d0311d4a0c1e77e13ec602cee0ddb2aa9f62595b17a3b3a1bc70622f745b66117934640d313eb5c6323aa
7
+ data.tar.gz: 17655fde4e9427fcd3989be0c1aa9cfce1b5e93a0ea9797e71da4d3f40f8287954189d59e6fbfb28f4361578c5e6c45272be28e384eb948e45c55059915efd08
data/.travis.yml CHANGED
@@ -1,6 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
6
+
7
+ gemfile:
8
+ - gemfiles/Gemfile.rails-3.2.x
9
+ - Gemfile
10
+
11
+ matrix:
12
+ exclude:
13
+ - rvm: 1.9.2
14
+ gemfile: Gemfile
15
+
data/README.md CHANGED
@@ -5,15 +5,17 @@ CachedResource is a Ruby gem whose goal is to increase the performance of intera
5
5
  gem install cached_resource
6
6
 
7
7
  ## Compatibility
8
- CachedResource has been tested with the following Ruby versions:
8
+ CachedResource supports the following Ruby versions:
9
9
 
10
- * 1.8.7
11
10
  * 1.9.2, 1.9.3
11
+ * 2.0.0
12
12
 
13
- CachedResource is designed to be framework agnostic, but will hook into Rails for caching and logging. If there is a `Rails.cache` and/or a `Rails.logger`, then it _should_ be OK. It is known to work with the following Rails versions:
13
+ If you require 1.8.7 support, please use version 2.3.4.
14
14
 
15
- * 3.1.3
16
- * 3.2.2, 3.2.3
15
+ CachedResource is designed to be framework agnostic, but will hook into Rails for caching and logging if available. CachedResource officially supports the following Rails versions:
16
+
17
+ * 3.2.x
18
+ * 4.0.0
17
19
 
18
20
  ## Configuration
19
21
  **Set up CachedResource across all ActiveResources:**
@@ -98,6 +100,10 @@ Sit back and relax! If you need to reload a particular request you can pass `:re
98
100
 
99
101
  MyActiveResource.find(:all, :reload => true)
100
102
 
103
+ If you need to clear the entire cache just do the following:
104
+
105
+ MyActiveResource.clear_cache
106
+
101
107
  ## Testing
102
108
  rake
103
109
 
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  s.add_dependency "rake"
20
- s.add_dependency "activeresource", "~> 3.2"
21
- s.add_dependency "activesupport", "~> 3.2"
20
+ s.add_dependency "activeresource", ">= 3.2"
21
+ s.add_dependency "activesupport", ">= 3.2"
22
22
  s.add_dependency "nilio", ">= 1.0"
23
23
 
24
24
  s.add_development_dependency "rspec"
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => "../"
4
+
5
+ gem "activeresource", "~> 3.2"
6
+ gem "activesupport", "~> 3.2"
7
+
8
+
@@ -22,6 +22,11 @@ module CachedResource
22
22
  should_reload ? find_via_reload(key, *arguments) : find_via_cache(key, *arguments)
23
23
  end
24
24
 
25
+ # Clear the cache.
26
+ def clear_cache
27
+ cache_clear
28
+ end
29
+
25
30
  private
26
31
 
27
32
  # Try to find a cached response for the given key. If
@@ -43,7 +48,7 @@ module CachedResource
43
48
  # write cache entries for all its members
44
49
  # otherwise update an existing collection if possible.
45
50
  def cache_collection_synchronize(object, *arguments)
46
- if object.is_a? Array
51
+ if object.is_a? Enumerable
47
52
  update_singles_cache(object)
48
53
  # update the collection only if this is a subset of it
49
54
  update_collection_cache(object) unless is_collection?(*arguments)
@@ -55,19 +60,18 @@ module CachedResource
55
60
  # Update the cache of singles with an array of updates.
56
61
  def update_singles_cache(updates)
57
62
  updates = Array(updates)
58
- updates.each { |object| cache_write(object.send(primary_key), object) }
63
+ updates.each { |object| cache_write(cache_key(object.send(primary_key)), object) }
59
64
  end
60
65
 
61
66
  # Update the "mother" collection with an array of updates.
62
67
  def update_collection_cache(updates)
63
68
  updates = Array(updates)
64
- collection = cache_read(cached_resource.collection_arguments)
69
+ collection = cache_read(cache_key(cached_resource.collection_arguments))
65
70
 
66
71
  if collection && !updates.empty?
67
- store = CachedResource::Configuration::ORDERED_HASH.new
68
- index = collection.inject(store) { |hash, object| hash[object.send(primary_key)] = object; hash }
72
+ index = collection.inject({}) { |hash, object| hash[object.send(primary_key)] = object; hash }
69
73
  updates.each { |object| index[object.send(primary_key)] = object }
70
- cache_write(cached_resource.collection_arguments, index.values)
74
+ cache_write(cache_key(cached_resource.collection_arguments), index.values)
71
75
  end
72
76
  end
73
77
 
@@ -78,9 +82,7 @@ module CachedResource
78
82
  end
79
83
 
80
84
  # Read a entry from the cache for the given key.
81
- # The key is processed to make sure it is valid.
82
85
  def cache_read(key)
83
- key = cache_key(Array(key)) unless key.is_a? String
84
86
  object = cached_resource.cache.read(key).try do |cache|
85
87
  if cache.is_a? Enumerable
86
88
  cache.map { |record| full_dup(record) }
@@ -93,14 +95,19 @@ module CachedResource
93
95
  end
94
96
 
95
97
  # Write an entry to the cache for the given key and value.
96
- # The key is processed to make sure it is valid.
97
98
  def cache_write(key, object)
98
- key = cache_key(Array(key)) unless key.is_a? String
99
99
  result = cached_resource.cache.write(key, object, :expires_in => cached_resource.generate_ttl)
100
100
  result && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} WRITE #{key}")
101
101
  result
102
102
  end
103
103
 
104
+ # Clear the cache.
105
+ def cache_clear
106
+ cached_resource.cache.clear.tap do |result|
107
+ cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} CLEAR")
108
+ end
109
+ end
110
+
104
111
  # Generate the request cache key.
105
112
  def cache_key(*arguments)
106
113
  "#{name.parameterize.gsub("-", "/")}/#{arguments.join('/')}".downcase
@@ -3,14 +3,15 @@ module CachedResource
3
3
  # for cached resource.
4
4
  class Configuration < OpenStruct
5
5
 
6
- # Determine and set an appropriate ordered hash based on the current ruby version
7
- ORDERED_HASH = RUBY_VERSION.to_f < 1.9 ? ActiveSupport::OrderedHash : Hash
8
-
9
6
  # default or fallback cache without rails
10
7
  CACHE = ActiveSupport::Cache::MemoryStore.new
11
8
 
12
9
  # default of fallback logger without rails
13
- LOGGER = ActiveSupport::BufferedLogger.new(NilIO.instance)
10
+ LOGGER = if defined?(ActiveSupport::Logger)
11
+ ActiveSupport::Logger.new(NilIO.instance)
12
+ else
13
+ ActiveSupport::BufferedLogger.new(NilIO.instance)
14
+ end
14
15
 
15
16
  # prefix for log messages
16
17
  LOGGER_PREFIX = "[cached_resource]"
@@ -1,3 +1,3 @@
1
1
  module CachedResource
2
- VERSION = "2.3.4"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -13,8 +13,12 @@ describe CachedResource do
13
13
  @thing2 = {:thing => {:id => 2, :name => "Joe"}}
14
14
  @other_thing2 = {:thing => {:id => 2, :name => "Jeb"}}
15
15
  @thing3 = {:thing => {:id => 3, :name => "Stu"}}
16
+ @string_thing = {:thing => {:id => "fded", :name => "Lev"}}
17
+ @other_string_thing = {:thing => {:id => "fded", :name => "Lon"}}
16
18
  @thing_json = @thing.to_json
17
19
  @other_thing_json = @other_thing.to_json
20
+ @string_thing_json = @string_thing.to_json
21
+ @other_string_thing_json = @other_string_thing.to_json
18
22
  end
19
23
 
20
24
  after(:each) do
@@ -32,6 +36,7 @@ describe CachedResource do
32
36
  ActiveResource::HttpMock.reset!
33
37
  ActiveResource::HttpMock.respond_to do |mock|
34
38
  mock.get "/things/1.json", {}, @thing_json
39
+ mock.get "/things/fded.json", {}, @string_thing_json
35
40
  end
36
41
  end
37
42
 
@@ -40,6 +45,17 @@ describe CachedResource do
40
45
  Thing.cached_resource.cache.read("thing/1").should == result
41
46
  end
42
47
 
48
+ it "should cache a response for a string primary key" do
49
+ result = Thing.find("fded")
50
+ Thing.cached_resource.cache.read("thing/fded").should == result
51
+ end
52
+
53
+ it "should empty the cache when clear_cache is called" do
54
+ result = Thing.find(1)
55
+ Thing.clear_cache
56
+ Thing.cached_resource.cache.read("thing/1").should == nil
57
+ end
58
+
43
59
  it "should cache a response with the same persistence" do
44
60
  result1 = Thing.find(1)
45
61
  result2 = Thing.find(1)
@@ -55,6 +71,15 @@ describe CachedResource do
55
71
  ActiveResource::HttpMock.requests.length.should == 1
56
72
  end
57
73
 
74
+ it "should read a response when the request is made again for a string primary key" do
75
+ # make a request
76
+ Thing.find("fded")
77
+ # make the same request
78
+ Thing.find("fded")
79
+ # only one request should have happened
80
+ ActiveResource::HttpMock.requests.length.should == 1
81
+ end
82
+
58
83
  it "should remake a request when reloaded" do
59
84
  # make a request
60
85
  Thing.find(1)
@@ -64,6 +89,15 @@ describe CachedResource do
64
89
  ActiveResource::HttpMock.requests.length.should == 2
65
90
  end
66
91
 
92
+ it "should remake a request when reloaded for a string primary key" do
93
+ # make a request
94
+ Thing.find("fded")
95
+ # make the same request, but reload it
96
+ Thing.find("fded", :reload => true)
97
+ # we should get two requests
98
+ ActiveResource::HttpMock.requests.length.should == 2
99
+ end
100
+
67
101
  it "should rewrite the cache when the request is reloaded" do
68
102
  # make a request
69
103
  Thing.find(1)
@@ -156,6 +190,15 @@ describe CachedResource do
156
190
 
157
191
  end
158
192
 
193
+ shared_examples "collection_cache_clearing" do
194
+ it "should empty the cache when clear_cache is called" do
195
+ Thing.clear_cache
196
+ Thing.cached_resource.cache.read("thing/all").should == nil
197
+ Thing.cached_resource.cache.read("thing/1").should == nil
198
+ end
199
+
200
+ end
201
+
159
202
  describe "when collection synchronize is enabled" do
160
203
  before(:each) do
161
204
  Thing.cached_resource.cache.clear
@@ -164,7 +207,8 @@ describe CachedResource do
164
207
  ActiveResource::HttpMock.reset!
165
208
  ActiveResource::HttpMock.respond_to do |mock|
166
209
  mock.get "/things/1.json", {}, @thing_json
167
- mock.get "/things.json", {}, [@thing[:thing]].to_json(:root => :thing)
210
+ mock.get "/things/fded.json", {}, @string_thing_json
211
+ mock.get "/things.json", {}, [@thing[:thing], @string_thing[:thing]].to_json(:root => :thing)
168
212
  end
169
213
 
170
214
  # make a request for all things
@@ -175,19 +219,25 @@ describe CachedResource do
175
219
 
176
220
  it "should write cache entries for its members" do
177
221
  result = Thing.find(1)
222
+ string_result = Thing.find("fded")
178
223
  # only the all request should have been made
179
224
  ActiveResource::HttpMock.requests.length.should == 1
180
225
  # the result should be cached with the appropriate key
181
226
  Thing.cached_resource.cache.read("thing/1").should == result
227
+ Thing.cached_resource.cache.read("thing/fded").should == string_result
182
228
  end
183
229
 
230
+ include_examples "collection_cache_clearing"
231
+
184
232
  it "should rewrite cache entries for its members when reloaded" do
185
233
  # get the soon to be stale result so that we have a cache entry
186
234
  old_result = Thing.find(1)
235
+ old_string_result = Thing.find("fded")
187
236
  # change the server
188
237
  ActiveResource::HttpMock.respond_to do |mock|
189
238
  mock.get "/things/1.json", {}, @other_thing_json
190
- mock.get "/things.json", {}, [@other_thing[:thing]].to_json(:root => :thing)
239
+ mock.get "/things/fded.json", {}, @other_string_thing_json
240
+ mock.get "/things.json", {}, [@other_thing[:thing], @other_string_thing[:thing]].to_json(:root => :thing)
191
241
  end
192
242
  # reload the collection
193
243
  Thing.all(:reload => true)
@@ -195,19 +245,26 @@ describe CachedResource do
195
245
  result = Thing.find(1)
196
246
  Thing.cached_resource.cache.read("thing/all")[0].should == result
197
247
  Thing.cached_resource.cache.read("thing/all")[0].name.should == result.name
248
+ string_result = Thing.find("fded")
249
+ Thing.cached_resource.cache.read("thing/all")[1].should == string_result
250
+ Thing.cached_resource.cache.read("thing/all")[1].name.should == string_result.name
198
251
  end
199
252
 
200
253
  it "should update the collection when an individual request is reloaded" do
201
254
  # change the server
202
255
  ActiveResource::HttpMock.respond_to do |mock|
203
256
  mock.get "/things/1.json", {}, @other_thing_json
204
- mock.get "/things.json", {}, [@other_thing[:thing]].to_json(:root => :thing)
257
+ mock.get "/things/fded.json", {}, @other_string_thing_json
258
+ mock.get "/things.json", {}, [@other_thing[:thing], @other_string_thing[:thing]].to_json(:root => :thing)
205
259
  end
206
260
 
207
261
  # reload the individual
208
262
  result = Thing.find(1, :reload => true)
209
263
  Thing.cached_resource.cache.read("thing/all")[0].should == result
210
264
  Thing.cached_resource.cache.read("thing/all")[0].name.should == result.name
265
+ string_result = Thing.find("fded", :reload => true)
266
+ Thing.cached_resource.cache.read("thing/all")[1].should == string_result
267
+ Thing.cached_resource.cache.read("thing/all")[1].name.should == string_result.name
211
268
  end
212
269
 
213
270
  it "should update both the collection and the member cache entries when a subset of the collection is retrieved" do
@@ -218,6 +275,7 @@ describe CachedResource do
218
275
  # change the server
219
276
  ActiveResource::HttpMock.respond_to do |mock|
220
277
  mock.get "/things.json?name=Ari", {}, [@other_thing[:thing]].to_json(:root => :thing)
278
+ mock.get "/things.json?name=Lon", {}, [@other_string_thing[:thing]].to_json(:root => :thing)
221
279
  end
222
280
 
223
281
  # make a request for a subset of the "mother" collection
@@ -228,12 +286,21 @@ describe CachedResource do
228
286
  # the individual should be updated to reflect the server change
229
287
  Thing.cached_resource.cache.read("thing/1").should == result[0]
230
288
  Thing.cached_resource.cache.read("thing/1").name.should == result[0].name
289
+
290
+ # make a request for a subset of the "mother" collection
291
+ result = Thing.find(:all, :params => {:name => "Lon"})
292
+ # the collection should be updated to reflect the server change
293
+ Thing.cached_resource.cache.read("thing/all")[1].should == result[0]
294
+ Thing.cached_resource.cache.read("thing/all")[1].name.should == result[0].name
295
+ # the individual should be updated to reflect the server change
296
+ Thing.cached_resource.cache.read("thing/fded").should == result[0]
297
+ Thing.cached_resource.cache.read("thing/fded").name.should == result[0].name
231
298
  end
232
299
 
233
300
  it "should maintain the order of the collection when updating it" do
234
301
  # change the server to return a longer collection
235
302
  ActiveResource::HttpMock.respond_to do |mock|
236
- mock.get "/things.json", {}, [@thing[:thing], @thing3[:thing], @thing2[:thing]].to_json(:root => :thing)
303
+ mock.get "/things.json", {}, [@thing[:thing], @thing3[:thing], @thing2[:thing], @string_thing[:thing]].to_json(:root => :thing)
237
304
  end
238
305
 
239
306
  # create cache entry for the collection (we reload because in before block we make an all request)
@@ -242,6 +309,7 @@ describe CachedResource do
242
309
  # change the server's response for the thing with id 2
243
310
  ActiveResource::HttpMock.respond_to do |mock|
244
311
  mock.get "/things/2.json", {}, @other_thing2.to_json(:root => :thing)
312
+ mock.get "/things/fded.json", {}, @other_string_thing.to_json(:root => :thing)
245
313
  end
246
314
 
247
315
  # get thing 2, thereby updating the collection
@@ -254,6 +322,17 @@ describe CachedResource do
254
322
  old_collection.each_with_index do |thing, i|
255
323
  updated_collection[i].id.should == thing.id
256
324
  end
325
+
326
+ # get string thing, thereby updating the collection
327
+ string_result = Thing.find("fded", :reload => true)
328
+ # get the updated collection from the cache
329
+ updated_collection = Thing.all
330
+ # name should have changed to "Lon"
331
+ updated_collection[3].name.should == string_result.name
332
+ # the updated collection should have the elements in the same order
333
+ old_collection.each_with_index do |thing, i|
334
+ updated_collection[i].id.should == thing.id
335
+ end
257
336
  end
258
337
  end
259
338
 
@@ -265,7 +344,8 @@ describe CachedResource do
265
344
  ActiveResource::HttpMock.reset!
266
345
  ActiveResource::HttpMock.respond_to do |mock|
267
346
  mock.get "/things/1.json", {}, @thing_json
268
- mock.get "/things.json", {}, [@thing[:thing]].to_json(:root => :thing)
347
+ mock.get "/things/fded.json", {}, @string_thing_json
348
+ mock.get "/things.json", {}, [@thing[:thing], @string_thing[:thing]].to_json(:root => :thing)
269
349
  end
270
350
 
271
351
  # make a request for all things
@@ -276,21 +356,30 @@ describe CachedResource do
276
356
 
277
357
  it "should not write cache entries for its members" do
278
358
  result = Thing.find(1)
359
+ result = Thing.find("fded")
279
360
  # both the all in the before each and this request should have been made
280
- ActiveResource::HttpMock.requests.length.should == 2
361
+ ActiveResource::HttpMock.requests.length.should == 3
281
362
  end
282
363
 
364
+ include_examples "collection_cache_clearing"
365
+
283
366
  it "should not update the collection when an individual request is reloaded" do
284
367
  # change the server
285
368
  ActiveResource::HttpMock.respond_to do |mock|
286
369
  mock.get "/things/1.json", {}, @other_thing_json
287
- mock.get "/things.json", {}, [@other_thing[:thing]].to_json(:root => :thing)
370
+ mock.get "/things/fded.json", {}, @other_string_thing_json
371
+ mock.get "/things.json", {}, [@other_thing[:thing], @other_string_thing[:thing]].to_json(:root => :thing)
288
372
  end
289
373
 
290
374
  # reload the individual
291
375
  result = Thing.find(1, :reload => true)
292
376
  # the ids are the same, but the names should be different
293
377
  Thing.cached_resource.cache.read("thing/all")[0].name.should_not == result.name
378
+
379
+ # reload the individual
380
+ string_result = Thing.find("fded", :reload => true)
381
+ # the ids are the same, but the names should be different
382
+ Thing.cached_resource.cache.read("thing/all")[1].name.should_not == string_result.name
294
383
  end
295
384
  end
296
385
 
@@ -324,6 +413,7 @@ describe CachedResource do
324
413
  ActiveResource::HttpMock.reset!
325
414
  ActiveResource::HttpMock.respond_to do |mock|
326
415
  mock.get "/things/1.json", {}, @thing_json
416
+ mock.get "/things/fded.json", {}, @string_thing_json
327
417
  end
328
418
  end
329
419
 
@@ -332,6 +422,11 @@ describe CachedResource do
332
422
  Thing.cached_resource.cache.read("thing/1").should == result
333
423
  end
334
424
 
425
+ it "should cache a response for a string primary key" do
426
+ result = Thing.find("fded")
427
+ Thing.cached_resource.cache.read("thing/fded").should == result
428
+ end
429
+
335
430
  it "should always remake the request" do
336
431
  Thing.find(1)
337
432
  ActiveResource::HttpMock.requests.length.should == 1
@@ -339,6 +434,13 @@ describe CachedResource do
339
434
  ActiveResource::HttpMock.requests.length.should == 2
340
435
  end
341
436
 
437
+ it "should always remake the request for a string primary key" do
438
+ Thing.find("fded")
439
+ ActiveResource::HttpMock.requests.length.should == 1
440
+ Thing.find("fded")
441
+ ActiveResource::HttpMock.requests.length.should == 2
442
+ end
443
+
342
444
  it "should rewrite the cache for each request" do
343
445
  Thing.find(1)
344
446
  old_result = Thing.cached_resource.cache.read("thing/1")
@@ -356,5 +458,23 @@ describe CachedResource do
356
458
  # not new?, and have the same id.
357
459
  new_result.name.should_not == old_result.name
358
460
  end
461
+
462
+ it "should rewrite the cache for each request for a string primary key" do
463
+ Thing.find("fded")
464
+ old_result = Thing.cached_resource.cache.read("thing/fded")
465
+
466
+ # change the response
467
+ ActiveResource::HttpMock.reset!
468
+ ActiveResource::HttpMock.respond_to do |mock|
469
+ mock.get "/things/fded.json", {}, @other_string_thing_json
470
+ end
471
+
472
+ Thing.find("fded")
473
+ new_result = Thing.cached_resource.cache.read("thing/fded")
474
+ # since active resources are equal if and only if they
475
+ # are the same object or an instance of the same class,
476
+ # not new?, and have the same id.
477
+ new_result.name.should_not == old_result.name
478
+ end
359
479
  end
360
480
  end
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe "CachedResource::Configuration" do
4
4
 
5
5
  let(:configuration) { CachedResource::Configuration.new }
6
+ let(:default_logger) { defined?(ActiveSupport::Logger) ? ActiveSupport::Logger : ActiveSupport::BufferedLogger }
6
7
 
7
8
  describe "by default" do
8
9
  it "should be enabled" do
@@ -23,12 +24,13 @@ describe "CachedResource::Configuration" do
23
24
 
24
25
  describe "outside a Rails environment" do
25
26
  it "should be logging to a buffered logger attached to a NilIO" do
26
- configuration.logger.class.should == ActiveSupport::BufferedLogger
27
+ configuration.logger.class.should == default_logger
27
28
  # ActiveSupport switched around the log destination variables
28
29
  # Check if either are what we expect to be compatible
29
30
  old_as = configuration.logger.instance_variable_get(:@log).class == NilIO
30
31
  new_as = configuration.logger.instance_variable_get(:@log_dest).class == NilIO
31
- (old_as || new_as).should == true
32
+ newer_as = configuration.logger.instance_variable_get(:@logdev).instance_variable_get(:@dev).class == NilIO
33
+ (old_as || new_as || newer_as).should == true
32
34
  end
33
35
 
34
36
  it "should cache responses in a memory store" do
@@ -173,7 +175,7 @@ describe "CachedResource::Configuration" do
173
175
  it "should have the default options for anything unspecified" do
174
176
  cr = Foo.cached_resource
175
177
  cr.cache.class.should == ActiveSupport::Cache::MemoryStore
176
- cr.logger.class.should == ActiveSupport::BufferedLogger
178
+ cr.logger.class.should == default_logger
177
179
  cr.enabled.should == true
178
180
  cr.collection_synchronize.should == false
179
181
  cr.collection_arguments.should == [:all]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cached_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Chan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -28,28 +28,28 @@ dependencies:
28
28
  name: activeresource
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
55
  - !ruby/object:Gem::Dependency
@@ -94,6 +94,7 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - cached_resource.gemspec
97
+ - gemfiles/Gemfile.rails-3.2.x
97
98
  - lib/cached_resource.rb
98
99
  - lib/cached_resource/cached_resource.rb
99
100
  - lib/cached_resource/caching.rb
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  version: '0'
122
123
  requirements: []
123
124
  rubyforge_project:
124
- rubygems_version: 2.0.3
125
+ rubygems_version: 2.0.5
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: Caching for ActiveResource