arid_cache 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- arid_cache (1.3.6)
4
+ arid_cache (1.4.1)
5
5
  will_paginate
6
6
 
7
7
  GEM
data/Gemfile.rails2.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- arid_cache (1.3.6)
4
+ arid_cache (1.4.0)
5
5
  will_paginate
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
data/arid_cache.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{arid_cache}
8
- s.version = "1.4.0"
8
+ s.version = "1.4.1"
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"]
12
- s.date = %q{2011-04-18}
12
+ s.date = %q{2011-04-19}
13
13
  s.description = %q{AridCache makes caching easy and effective. AridCache supports caching on all your model named scopes, class methods and instance methods right out of the box. AridCache prevents caching logic from cluttering your models and clarifies your logic by making explicit calls to cached result sets.
14
14
  AridCache is designed for handling large, expensive ActiveRecord collections but is equally useful for caching anything else as well.
15
15
  }
@@ -20,6 +20,7 @@ module AridCache
20
20
  end
21
21
  paginate_opts[:per_page] = klass && klass.per_page || 30
22
22
  end
23
+ paginate_opts[:page] = 1 if paginate_opts[:page].nil?
23
24
  paginate_opts[:total_entries] = records.size unless records.nil?
24
25
  paginate_opts
25
26
  end
@@ -42,4 +42,18 @@ describe AridCache do
42
42
  AridCache.raw_with_options = true
43
43
  AridCache.raw_with_options.should be_true
44
44
  end
45
+
46
+ describe "pagination" do
47
+ before :each do
48
+ @user = User.make
49
+ @user.companies << Company.make
50
+ end
51
+
52
+ it "should not fail if the page is nil" do
53
+ lambda {
54
+ @user.cached_companies(:page => nil)
55
+ @user.cached_companies(:page => nil) # works when seeding, so call again to load from cache
56
+ }.should_not raise_error(WillPaginate::InvalidPage)
57
+ end
58
+ end
45
59
  end
@@ -24,10 +24,13 @@ describe AridCache::CacheProxy::Options do
24
24
  new_options(:force => true).force?.should be_true
25
25
  end
26
26
 
27
- it "paginate?" do
28
- new_options(:page => 1).paginate?.should be_true
29
- new_options(:per_page => 1).paginate?.should be_false
30
- new_options(:page => 1, :per_page => 1).paginate?.should be_true
27
+ describe "paginate?" do
28
+ it "should be true if the :page option is present" do
29
+ new_options(:page => 1).paginate?.should be_true
30
+ new_options(:page => nil).paginate?.should be_true
31
+ new_options(:per_page => 1).paginate?.should be_false
32
+ new_options(:page => 1, :per_page => 1).paginate?.should be_true
33
+ end
31
34
  end
32
35
 
33
36
  it "raw?" do
@@ -98,6 +101,12 @@ describe AridCache::CacheProxy::Options do
98
101
  :per_page => 3
99
102
  ).opts_for_paginate[:per_page].should == 3
100
103
  end
104
+
105
+ it "page should default to 1 if it is nil" do
106
+ new_options(
107
+ :page => nil
108
+ ).opts_for_paginate[:page].should == 1
109
+ end
101
110
  end
102
111
 
103
112
  describe "proxies" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arid_cache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl Varga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-18 00:00:00 -07:00
18
+ date: 2011-04-19 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency