arid_cache 0.2.6 → 0.2.7

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
data/arid_cache.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{arid_cache}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karl Varga"]
@@ -47,11 +47,11 @@ module AridCache
47
47
  # Fetching results
48
48
  #
49
49
 
50
- def self.fetch_count(object, key, opts, &block)
50
+ def self.fetch_count(object, key, opts={}, &block)
51
51
  CacheProxy.new(object, key, opts, &block).fetch_count
52
52
  end
53
53
 
54
- def self.fetch(object, key, opts, &block)
54
+ def self.fetch(object, key, opts={}, &block)
55
55
  CacheProxy.new(object, key, opts, &block).fetch
56
56
  end
57
57
 
@@ -143,7 +143,7 @@ module AridCache
143
143
  end
144
144
 
145
145
  def get_records
146
- block = block || (blueprint && blueprint.proc)
146
+ block = self.block || (blueprint && blueprint.proc)
147
147
  self.records = block.nil? ? object.instance_eval(key) : object.instance_eval(&block)
148
148
  end
149
149
 
@@ -328,7 +328,16 @@ class AridCacheTest < ActiveSupport::TestCase
328
328
  assert_equal (total/3.0).ceil, page.total_pages
329
329
  end
330
330
  end
331
-
331
+
332
+ test "should support calling store methods directly with a block" do
333
+ assert_nothing_raised do
334
+ AridCache.cache.fetch(@user, 'my-fancy-key') do
335
+ companies
336
+ end
337
+ end
338
+ assert_equal @user.companies.all(:order => 'name DESC'), AridCache.cache.fetch(@user, 'my-fancy-key', :order => 'name DESC') { companies }
339
+ end
340
+
332
341
  #
333
342
  # Tests requiring manual verification by looking at the SQL logs.
334
343
  # TODO move these to a separate class.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arid_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Varga