kaminari 0.14.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kaminari might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.document +1 -4
- data/.gitignore +1 -0
- data/.travis.yml +52 -5
- data/{CHANGELOG → CHANGELOG.rdoc} +129 -0
- data/Gemfile +1 -1
- data/README.rdoc +66 -25
- data/Rakefile +32 -9
- data/app/views/kaminari/_first_page.html.erb +1 -1
- data/app/views/kaminari/_first_page.html.haml +1 -1
- data/app/views/kaminari/_first_page.html.slim +1 -1
- data/app/views/kaminari/_gap.html.erb +1 -1
- data/app/views/kaminari/_gap.html.haml +1 -1
- data/app/views/kaminari/_gap.html.slim +1 -1
- data/app/views/kaminari/_last_page.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.haml +1 -1
- data/app/views/kaminari/_last_page.html.slim +1 -1
- data/app/views/kaminari/_next_page.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.haml +1 -1
- data/app/views/kaminari/_next_page.html.slim +1 -1
- data/app/views/kaminari/_prev_page.html.erb +1 -1
- data/app/views/kaminari/_prev_page.html.haml +1 -1
- data/app/views/kaminari/_prev_page.html.slim +1 -1
- data/gemfiles/active_record_30.gemfile +25 -4
- data/gemfiles/active_record_31.gemfile +23 -4
- data/gemfiles/active_record_32.gemfile +22 -4
- data/gemfiles/active_record_40.gemfile +26 -0
- data/gemfiles/active_record_41.gemfile +25 -0
- data/gemfiles/active_record_42.gemfile +25 -0
- data/gemfiles/active_record_edge.gemfile +30 -0
- data/gemfiles/data_mapper_12.gemfile +30 -10
- data/gemfiles/mongo_mapper.gemfile +20 -2
- data/gemfiles/mongoid_30.gemfile +18 -3
- data/gemfiles/mongoid_31.gemfile +21 -0
- data/gemfiles/mongoid_40.gemfile +19 -0
- data/gemfiles/mongoid_50.gemfile +23 -0
- data/gemfiles/sinatra_13.gemfile +36 -0
- data/gemfiles/sinatra_14.gemfile +33 -0
- data/kaminari.gemspec +13 -14
- data/lib/generators/kaminari/views_generator.rb +9 -8
- data/lib/kaminari/config.rb +2 -0
- data/lib/kaminari/helpers/action_view_extension.rb +9 -28
- data/lib/kaminari/helpers/paginator.rb +38 -18
- data/lib/kaminari/helpers/sinatra_helpers.rb +41 -3
- data/lib/kaminari/helpers/tags.rb +18 -5
- data/lib/kaminari/hooks.rb +31 -15
- data/lib/kaminari/models/active_record_extension.rb +8 -8
- data/lib/kaminari/models/active_record_model_extension.rb +8 -6
- data/lib/kaminari/models/active_record_relation_methods.rb +21 -10
- data/lib/kaminari/models/array_extension.rb +17 -11
- data/lib/kaminari/models/configuration_methods.rb +16 -2
- data/lib/kaminari/models/data_mapper_collection_methods.rb +4 -0
- data/lib/kaminari/models/data_mapper_extension.rb +5 -2
- data/lib/kaminari/models/mongoid_criteria_methods.rb +18 -1
- data/lib/kaminari/models/mongoid_extension.rb +8 -15
- data/lib/kaminari/models/page_scope_methods.rb +37 -5
- data/lib/kaminari/models/plucky_criteria_methods.rb +6 -1
- data/lib/kaminari/railtie.rb +1 -1
- data/lib/kaminari/sinatra.rb +2 -0
- data/lib/kaminari/version.rb +1 -1
- data/lib/kaminari.rb +5 -4
- data/spec/config/config_spec.rb +15 -0
- data/spec/fake_app/active_record/config.rb +1 -1
- data/spec/fake_app/active_record/models.rb +9 -1
- data/spec/fake_app/mongo_mapper/config.rb +1 -1
- data/spec/fake_app/mongoid/config.rb +7 -3
- data/spec/fake_app/mongoid/models.rb +16 -0
- data/spec/fake_app/rails_app.rb +1 -0
- data/spec/fake_app/views/alternative/kaminari/_first_page.html.erb +1 -0
- data/spec/fake_app/views/alternative/kaminari/_paginator.html.erb +3 -0
- data/spec/fake_app/views/kaminari/bootstrap/_page.html.erb +1 -0
- data/spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb +7 -0
- data/spec/fake_gem.rb +18 -2
- data/spec/generators/views_generator_spec.rb +18 -0
- data/spec/helpers/action_view_extension_spec.rb +68 -12
- data/spec/helpers/helpers_spec.rb +9 -0
- data/spec/helpers/sinatra_helpers_spec.rb +53 -0
- data/spec/models/active_record/active_record_relation_methods_spec.rb +48 -1
- data/spec/models/active_record/inherited_spec.rb +9 -0
- data/spec/models/active_record/scopes_spec.rb +104 -5
- data/spec/models/array_spec.rb +55 -4
- data/spec/models/configuration_methods_spec.rb +125 -0
- data/spec/models/data_mapper/data_mapper_spec.rb +76 -26
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +12 -0
- data/spec/models/mongoid/mongoid_spec.rb +119 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/spec_helper_for_sinatra.rb +2 -3
- data/spec/support/database_cleaner.rb +5 -2
- metadata +63 -87
- data/gemfiles/mongoid_24.gemfile +0 -7
- data/gemfiles/sinatra.gemfile +0 -10
- data/spec/models/active_record/default_per_page_spec.rb +0 -32
- data/spec/models/active_record/max_per_page_spec.rb +0 -32
@@ -1,6 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
if defined? Mongoid
|
4
|
+
describe Kaminari::MongoidCriteriaMethods do
|
5
|
+
describe "#total_count" do
|
6
|
+
before do
|
7
|
+
2.times {|i| User.create!(:salary => i) }
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when the scope is cloned" do
|
11
|
+
it "should reset total_coount momoization" do
|
12
|
+
User.page.tap(&:total_count).where(:salary => 1).total_count.should == 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
describe Kaminari::MongoidExtension do
|
5
19
|
before(:each) do
|
6
20
|
41.times do
|
@@ -8,12 +22,68 @@ if defined? Mongoid
|
|
8
22
|
end
|
9
23
|
end
|
10
24
|
|
25
|
+
describe 'max_scan', :if => Mongoid::VERSION >= '3' do
|
26
|
+
context 'less than total' do
|
27
|
+
context 'page 1' do
|
28
|
+
subject { User.max_scan(20).page 1 }
|
29
|
+
it { should be_a Mongoid::Criteria }
|
30
|
+
its(:current_page) { should == 1 }
|
31
|
+
its(:prev_page) { should be_nil }
|
32
|
+
its(:next_page) { should be_nil }
|
33
|
+
its(:limit_value) { should == 25 }
|
34
|
+
its(:total_pages) { should == 1 }
|
35
|
+
its(:total_count) { should == 20 }
|
36
|
+
it { should skip(0) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'page 2' do
|
40
|
+
subject { User.max_scan(30).page 2 }
|
41
|
+
it { should be_a Mongoid::Criteria }
|
42
|
+
its(:current_page) { should == 2 }
|
43
|
+
its(:prev_page) { should == 1 }
|
44
|
+
its(:next_page) { should be_nil }
|
45
|
+
its(:limit_value) { should == 25 }
|
46
|
+
its(:total_pages) { should == 2 }
|
47
|
+
its(:total_count) { should == 30 }
|
48
|
+
it { should skip 25 }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'more than total' do
|
53
|
+
context 'page 1' do
|
54
|
+
subject { User.max_scan(60).page 1 }
|
55
|
+
it { should be_a Mongoid::Criteria }
|
56
|
+
its(:current_page) { should == 1 }
|
57
|
+
its(:prev_page) { should be_nil }
|
58
|
+
its(:next_page) { should == 2 }
|
59
|
+
its(:limit_value) { should == 25 }
|
60
|
+
its(:total_pages) { should == 2 }
|
61
|
+
its(:total_count) { should == 41 }
|
62
|
+
it { should skip(0) }
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'page 2' do
|
66
|
+
subject { User.max_scan(60).page 2 }
|
67
|
+
it { should be_a Mongoid::Criteria }
|
68
|
+
its(:current_page) { should == 2 }
|
69
|
+
its(:prev_page) { should == 1 }
|
70
|
+
its(:next_page) { should be_nil }
|
71
|
+
its(:limit_value) { should == 25 }
|
72
|
+
its(:total_pages) { should == 2 }
|
73
|
+
its(:total_count) { should == 41 }
|
74
|
+
it { should skip 25 }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
11
79
|
describe '#page' do
|
12
80
|
|
13
81
|
context 'page 1' do
|
14
82
|
subject { User.page 1 }
|
15
83
|
it { should be_a Mongoid::Criteria }
|
16
84
|
its(:current_page) { should == 1 }
|
85
|
+
its(:prev_page) { should be_nil }
|
86
|
+
its(:next_page) { should == 2 }
|
17
87
|
its(:limit_value) { should == 25 }
|
18
88
|
its(:total_pages) { should == 2 }
|
19
89
|
it { should skip(0) }
|
@@ -23,6 +93,8 @@ if defined? Mongoid
|
|
23
93
|
subject { User.page 2 }
|
24
94
|
it { should be_a Mongoid::Criteria }
|
25
95
|
its(:current_page) { should == 2 }
|
96
|
+
its(:prev_page) { should == 1 }
|
97
|
+
its(:next_page) { should be_nil }
|
26
98
|
its(:limit_value) { should == 25 }
|
27
99
|
its(:total_pages) { should == 2 }
|
28
100
|
it { should skip 25 }
|
@@ -32,18 +104,22 @@ if defined? Mongoid
|
|
32
104
|
subject { User.page 'foobar' }
|
33
105
|
it { should be_a Mongoid::Criteria }
|
34
106
|
its(:current_page) { should == 1 }
|
107
|
+
its(:prev_page) { should be_nil }
|
108
|
+
its(:next_page) { should == 2 }
|
35
109
|
its(:limit_value) { should == 25 }
|
36
110
|
its(:total_pages) { should == 2 }
|
37
111
|
it { should skip 0 }
|
38
112
|
end
|
39
113
|
|
40
114
|
shared_examples 'complete valid pagination' do
|
41
|
-
if Mongoid::VERSION
|
115
|
+
if Mongoid::VERSION > '3.0.0'
|
42
116
|
its(:selector) { should == {'salary' => 1} }
|
43
117
|
else
|
44
118
|
its(:selector) { should == {:salary => 1} }
|
45
119
|
end
|
46
120
|
its(:current_page) { should == 2 }
|
121
|
+
its(:prev_page) { should == 1 }
|
122
|
+
its(:next_page) { should be_nil }
|
47
123
|
its(:limit_value) { should == 25 }
|
48
124
|
its(:total_pages) { should == 2 }
|
49
125
|
it { should skip 25 }
|
@@ -58,12 +134,31 @@ if defined? Mongoid
|
|
58
134
|
subject { User.page(2).where(:salary => 1) }
|
59
135
|
it_should_behave_like 'complete valid pagination'
|
60
136
|
end
|
137
|
+
|
138
|
+
context "with database:", :if => Mongoid::VERSION >= '3' do
|
139
|
+
before :all do
|
140
|
+
15.times { User.with(:database => "default_db").create!(:salary => 1) }
|
141
|
+
10.times { User.with(:database => "other_db").create!(:salary => 1) }
|
142
|
+
end
|
143
|
+
|
144
|
+
context "default_db" do
|
145
|
+
subject { User.with(:database => "default_db").order_by(:artist.asc).page(1) }
|
146
|
+
its(:total_count) { should == 15 }
|
147
|
+
end
|
148
|
+
|
149
|
+
context "other_db" do
|
150
|
+
subject { User.with(:database => "other_db").order_by(:artist.asc).page(1) }
|
151
|
+
its(:total_count) { should == 10 }
|
152
|
+
end
|
153
|
+
end
|
61
154
|
end
|
62
155
|
|
63
156
|
describe '#per' do
|
64
157
|
subject { User.page(2).per(10) }
|
65
158
|
it { should be_a Mongoid::Criteria }
|
66
159
|
its(:current_page) { should == 2 }
|
160
|
+
its(:prev_page) { should == 1 }
|
161
|
+
its(:next_page) { should == 3 }
|
67
162
|
its(:limit_value) { should == 10 }
|
68
163
|
its(:total_pages) { should == 5 }
|
69
164
|
it { should skip 10 }
|
@@ -85,6 +180,8 @@ if defined? Mongoid
|
|
85
180
|
its(:total_count) { should == 5 }
|
86
181
|
its(:limit_value) { should == 1 }
|
87
182
|
its(:current_page) { should == 1 }
|
183
|
+
its(:prev_page) { should be_nil }
|
184
|
+
its(:next_page) { should == 2 }
|
88
185
|
its(:total_pages) { should == 5 }
|
89
186
|
end
|
90
187
|
|
@@ -94,6 +191,8 @@ if defined? Mongoid
|
|
94
191
|
its(:total_count) { should == 3 }
|
95
192
|
its(:limit_value) { should == 2 }
|
96
193
|
its(:current_page) { should == 1 }
|
194
|
+
its(:prev_page) { should be_nil }
|
195
|
+
its(:next_page) { should == 2 }
|
97
196
|
its(:total_pages) { should == 2 }
|
98
197
|
end
|
99
198
|
|
@@ -103,8 +202,27 @@ if defined? Mongoid
|
|
103
202
|
its(:total_count) { should == 3 }
|
104
203
|
its(:limit_value) { should == 2 }
|
105
204
|
its(:current_page) { should == 1 }
|
205
|
+
its(:prev_page) { should be_nil }
|
206
|
+
its(:next_page) { should == 2 }
|
106
207
|
its(:total_pages) { should == 2 }
|
107
208
|
end
|
108
209
|
end
|
210
|
+
|
211
|
+
describe '#paginates_per' do
|
212
|
+
context 'when paginates_per is not defined in superclass' do
|
213
|
+
subject { Product.all.page 1 }
|
214
|
+
its(:limit_value) { should == 25 }
|
215
|
+
end
|
216
|
+
|
217
|
+
context 'when paginates_per is defined in subclass' do
|
218
|
+
subject { Device.all.page 1 }
|
219
|
+
its(:limit_value) { should == 100 }
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'when paginates_per is defined in subclass of subclass' do
|
223
|
+
subject { Android.all.page 1 }
|
224
|
+
its(:limit_value) { should == 200 }
|
225
|
+
end
|
226
|
+
end
|
109
227
|
end
|
110
228
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,6 +9,7 @@ end
|
|
9
9
|
require 'bundler/setup'
|
10
10
|
Bundler.require
|
11
11
|
|
12
|
+
require 'capybara/rspec'
|
12
13
|
require 'database_cleaner'
|
13
14
|
|
14
15
|
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
|
@@ -29,4 +30,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
29
30
|
|
30
31
|
RSpec.configure do |config|
|
31
32
|
config.mock_with :rr
|
33
|
+
config.filter_run_excluding :generator_spec => true if !ENV['GENERATOR_SPEC']
|
32
34
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'kaminari/sinatra'
|
2
|
+
require 'kaminari/helpers/action_view_extension'
|
2
3
|
require 'rack/test'
|
3
4
|
require 'sinatra/test_helpers'
|
4
|
-
require 'capybara/dsl'
|
5
5
|
require 'capybara/rspec'
|
6
6
|
|
7
7
|
require 'fake_app/sinatra_app'
|
@@ -17,14 +17,13 @@ module HelperMethodForHelperSpec
|
|
17
17
|
|
18
18
|
def helper
|
19
19
|
# OMG terrible object...
|
20
|
-
Kaminari::Helpers::SinatraHelpers::ActionViewTemplateProxy.new(:current_params => {}, :current_path => '/', :param_name => Kaminari.config.param_name).extend(Padrino::Helpers, Kaminari::ActionViewExtension, Kaminari::Helpers::SinatraHelpers::HelperMethods, FakeEnv)
|
20
|
+
::Kaminari::Helpers::SinatraHelpers::ActionViewTemplateProxy.new(:current_params => {}, :current_path => '/', :param_name => Kaminari.config.param_name).extend(Padrino::Helpers, Kaminari::ActionViewExtension, Kaminari::Helpers::SinatraHelpers::HelperMethods, FakeEnv)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
RSpec.configure do |config|
|
25
25
|
config.include Rack::Test::Methods
|
26
26
|
config.include Sinatra::TestHelpers
|
27
|
-
config.include Capybara::DSL
|
28
27
|
config.include HelperMethodForHelperSpec
|
29
28
|
# config.include HelperMethodForHelperSpec, :type => :helper
|
30
29
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
DatabaseCleaner[:active_record].strategy = :transaction if defined? ActiveRecord
|
2
|
-
DatabaseCleaner[:data_mapper].strategy = :
|
2
|
+
DatabaseCleaner[:data_mapper].strategy = :truncation if defined? DataMapper
|
3
3
|
DatabaseCleaner[:mongoid].strategy = :truncation if defined? Mongoid
|
4
4
|
DatabaseCleaner[:mongo_mapper].strategy = :truncation if defined? MongoMapper
|
5
5
|
|
6
6
|
RSpec.configure do |config|
|
7
7
|
config.before :suite do
|
8
|
-
DatabaseCleaner.clean_with :truncation
|
8
|
+
DatabaseCleaner.clean_with :truncation if defined? ActiveRecord
|
9
|
+
DatabaseCleaner.clean_with :truncation if defined? DataMapper
|
10
|
+
DatabaseCleaner.clean_with :truncation if defined? Mongoid
|
11
|
+
DatabaseCleaner.clean_with :truncation if defined? MongoMapper
|
9
12
|
end
|
10
13
|
config.before :each do
|
11
14
|
DatabaseCleaner.start
|
metadata
CHANGED
@@ -1,194 +1,160 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaminari
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.17.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Akira Matsuda
|
8
|
+
- Yuki Nishijima
|
9
|
+
- Zachary Scott
|
10
|
+
- Hiroshi Shibata
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date:
|
14
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: activesupport
|
16
18
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
19
|
requirements:
|
19
|
-
- -
|
20
|
+
- - ">="
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 3.0.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: actionpack
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
33
|
requirements:
|
35
|
-
- -
|
34
|
+
- - ">="
|
36
35
|
- !ruby/object:Gem::Version
|
37
36
|
version: 3.0.0
|
38
37
|
type: :runtime
|
39
38
|
prerelease: false
|
40
39
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
40
|
requirements:
|
43
|
-
- -
|
41
|
+
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
43
|
version: 3.0.0
|
46
44
|
- !ruby/object:Gem::Dependency
|
47
45
|
name: bundler
|
48
46
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
47
|
requirements:
|
51
|
-
- -
|
48
|
+
- - ">="
|
52
49
|
- !ruby/object:Gem::Version
|
53
50
|
version: 1.0.0
|
54
51
|
type: :development
|
55
52
|
prerelease: false
|
56
53
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
54
|
requirements:
|
59
|
-
- -
|
55
|
+
- - ">="
|
60
56
|
- !ruby/object:Gem::Version
|
61
57
|
version: 1.0.0
|
62
58
|
- !ruby/object:Gem::Dependency
|
63
59
|
name: rake
|
64
60
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
61
|
requirements:
|
67
|
-
- -
|
62
|
+
- - ">="
|
68
63
|
- !ruby/object:Gem::Version
|
69
64
|
version: '0'
|
70
65
|
type: :development
|
71
66
|
prerelease: false
|
72
67
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
68
|
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: sqlite3
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
69
|
+
- - ">="
|
92
70
|
- !ruby/object:Gem::Version
|
93
71
|
version: '0'
|
94
72
|
- !ruby/object:Gem::Dependency
|
95
73
|
name: tzinfo
|
96
74
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
75
|
requirements:
|
99
|
-
- -
|
76
|
+
- - ">="
|
100
77
|
- !ruby/object:Gem::Version
|
101
78
|
version: '0'
|
102
79
|
type: :development
|
103
80
|
prerelease: false
|
104
81
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
82
|
requirements:
|
107
|
-
- -
|
83
|
+
- - ">="
|
108
84
|
- !ruby/object:Gem::Version
|
109
85
|
version: '0'
|
110
86
|
- !ruby/object:Gem::Dependency
|
111
87
|
name: rspec
|
112
88
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
89
|
requirements:
|
115
|
-
- -
|
90
|
+
- - ">="
|
116
91
|
- !ruby/object:Gem::Version
|
117
92
|
version: '0'
|
118
93
|
type: :development
|
119
94
|
prerelease: false
|
120
95
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
96
|
requirements:
|
123
|
-
- -
|
97
|
+
- - ">="
|
124
98
|
- !ruby/object:Gem::Version
|
125
99
|
version: '0'
|
126
100
|
- !ruby/object:Gem::Dependency
|
127
101
|
name: rr
|
128
102
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
103
|
requirements:
|
131
|
-
- -
|
104
|
+
- - ">="
|
132
105
|
- !ruby/object:Gem::Version
|
133
106
|
version: '0'
|
134
107
|
type: :development
|
135
108
|
prerelease: false
|
136
109
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
110
|
requirements:
|
139
|
-
- -
|
111
|
+
- - ">="
|
140
112
|
- !ruby/object:Gem::Version
|
141
113
|
version: '0'
|
142
114
|
- !ruby/object:Gem::Dependency
|
143
115
|
name: capybara
|
144
116
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
117
|
requirements:
|
147
|
-
- -
|
118
|
+
- - ">="
|
148
119
|
- !ruby/object:Gem::Version
|
149
120
|
version: '1.0'
|
150
121
|
type: :development
|
151
122
|
prerelease: false
|
152
123
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
124
|
requirements:
|
155
|
-
- -
|
125
|
+
- - ">="
|
156
126
|
- !ruby/object:Gem::Version
|
157
127
|
version: '1.0'
|
158
128
|
- !ruby/object:Gem::Dependency
|
159
129
|
name: database_cleaner
|
160
130
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
131
|
requirements:
|
163
|
-
- -
|
132
|
+
- - "~>"
|
164
133
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
134
|
+
version: 1.2.0
|
166
135
|
type: :development
|
167
136
|
prerelease: false
|
168
137
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
138
|
requirements:
|
171
|
-
- -
|
139
|
+
- - "~>"
|
172
140
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
141
|
+
version: 1.2.0
|
174
142
|
- !ruby/object:Gem::Dependency
|
175
143
|
name: rdoc
|
176
144
|
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
145
|
requirements:
|
179
|
-
- -
|
146
|
+
- - ">="
|
180
147
|
- !ruby/object:Gem::Version
|
181
148
|
version: '0'
|
182
149
|
type: :development
|
183
150
|
prerelease: false
|
184
151
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
152
|
requirements:
|
187
|
-
- -
|
153
|
+
- - ">="
|
188
154
|
- !ruby/object:Gem::Version
|
189
155
|
version: '0'
|
190
156
|
description: Kaminari is a Scope & Engine based, clean, powerful, agnostic, customizable
|
191
|
-
and sophisticated paginator for Rails 3
|
157
|
+
and sophisticated paginator for Rails 3+
|
192
158
|
email:
|
193
159
|
- ronnie@dio.jp
|
194
160
|
executables: []
|
@@ -196,12 +162,12 @@ extensions: []
|
|
196
162
|
extra_rdoc_files:
|
197
163
|
- README.rdoc
|
198
164
|
files:
|
199
|
-
- .document
|
200
|
-
- .gemtest
|
201
|
-
- .gitignore
|
202
|
-
- .rspec
|
203
|
-
- .travis.yml
|
204
|
-
- CHANGELOG
|
165
|
+
- ".document"
|
166
|
+
- ".gemtest"
|
167
|
+
- ".gitignore"
|
168
|
+
- ".rspec"
|
169
|
+
- ".travis.yml"
|
170
|
+
- CHANGELOG.rdoc
|
205
171
|
- Gemfile
|
206
172
|
- MIT-LICENSE
|
207
173
|
- README.rdoc
|
@@ -231,11 +197,18 @@ files:
|
|
231
197
|
- gemfiles/active_record_30.gemfile
|
232
198
|
- gemfiles/active_record_31.gemfile
|
233
199
|
- gemfiles/active_record_32.gemfile
|
200
|
+
- gemfiles/active_record_40.gemfile
|
201
|
+
- gemfiles/active_record_41.gemfile
|
202
|
+
- gemfiles/active_record_42.gemfile
|
203
|
+
- gemfiles/active_record_edge.gemfile
|
234
204
|
- gemfiles/data_mapper_12.gemfile
|
235
205
|
- gemfiles/mongo_mapper.gemfile
|
236
|
-
- gemfiles/mongoid_24.gemfile
|
237
206
|
- gemfiles/mongoid_30.gemfile
|
238
|
-
- gemfiles/
|
207
|
+
- gemfiles/mongoid_31.gemfile
|
208
|
+
- gemfiles/mongoid_40.gemfile
|
209
|
+
- gemfiles/mongoid_50.gemfile
|
210
|
+
- gemfiles/sinatra_13.gemfile
|
211
|
+
- gemfiles/sinatra_14.gemfile
|
239
212
|
- kaminari.gemspec
|
240
213
|
- lib/generators/kaminari/config_generator.rb
|
241
214
|
- lib/generators/kaminari/templates/kaminari_config.rb
|
@@ -275,16 +248,21 @@ files:
|
|
275
248
|
- spec/fake_app/mongoid/models.rb
|
276
249
|
- spec/fake_app/rails_app.rb
|
277
250
|
- spec/fake_app/sinatra_app.rb
|
251
|
+
- spec/fake_app/views/alternative/kaminari/_first_page.html.erb
|
252
|
+
- spec/fake_app/views/alternative/kaminari/_paginator.html.erb
|
253
|
+
- spec/fake_app/views/kaminari/bootstrap/_page.html.erb
|
254
|
+
- spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb
|
278
255
|
- spec/fake_gem.rb
|
256
|
+
- spec/generators/views_generator_spec.rb
|
279
257
|
- spec/helpers/action_view_extension_spec.rb
|
280
258
|
- spec/helpers/helpers_spec.rb
|
281
259
|
- spec/helpers/sinatra_helpers_spec.rb
|
282
260
|
- spec/helpers/tags_spec.rb
|
283
261
|
- spec/models/active_record/active_record_relation_methods_spec.rb
|
284
|
-
- spec/models/active_record/
|
285
|
-
- spec/models/active_record/max_per_page_spec.rb
|
262
|
+
- spec/models/active_record/inherited_spec.rb
|
286
263
|
- spec/models/active_record/scopes_spec.rb
|
287
264
|
- spec/models/array_spec.rb
|
265
|
+
- spec/models/configuration_methods_spec.rb
|
288
266
|
- spec/models/data_mapper/data_mapper_spec.rb
|
289
267
|
- spec/models/mongo_mapper/mongo_mapper_spec.rb
|
290
268
|
- spec/models/mongoid/mongoid_spec.rb
|
@@ -296,34 +274,27 @@ files:
|
|
296
274
|
homepage: https://github.com/amatsuda/kaminari
|
297
275
|
licenses:
|
298
276
|
- MIT
|
277
|
+
metadata: {}
|
299
278
|
post_install_message:
|
300
279
|
rdoc_options: []
|
301
280
|
require_paths:
|
302
281
|
- lib
|
303
282
|
required_ruby_version: !ruby/object:Gem::Requirement
|
304
|
-
none: false
|
305
283
|
requirements:
|
306
|
-
- -
|
284
|
+
- - ">="
|
307
285
|
- !ruby/object:Gem::Version
|
308
286
|
version: '0'
|
309
|
-
segments:
|
310
|
-
- 0
|
311
|
-
hash: -1633849575199426851
|
312
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
|
-
none: false
|
314
288
|
requirements:
|
315
|
-
- -
|
289
|
+
- - ">="
|
316
290
|
- !ruby/object:Gem::Version
|
317
291
|
version: '0'
|
318
|
-
segments:
|
319
|
-
- 0
|
320
|
-
hash: -1633849575199426851
|
321
292
|
requirements: []
|
322
293
|
rubyforge_project: kaminari
|
323
|
-
rubygems_version:
|
294
|
+
rubygems_version: 2.6.4
|
324
295
|
signing_key:
|
325
|
-
specification_version:
|
326
|
-
summary: A pagination engine plugin for Rails 3
|
296
|
+
specification_version: 4
|
297
|
+
summary: A pagination engine plugin for Rails 3+ and other modern frameworks
|
327
298
|
test_files:
|
328
299
|
- spec/config/config_spec.rb
|
329
300
|
- spec/fake_app/active_record/config.rb
|
@@ -336,16 +307,21 @@ test_files:
|
|
336
307
|
- spec/fake_app/mongoid/models.rb
|
337
308
|
- spec/fake_app/rails_app.rb
|
338
309
|
- spec/fake_app/sinatra_app.rb
|
310
|
+
- spec/fake_app/views/alternative/kaminari/_first_page.html.erb
|
311
|
+
- spec/fake_app/views/alternative/kaminari/_paginator.html.erb
|
312
|
+
- spec/fake_app/views/kaminari/bootstrap/_page.html.erb
|
313
|
+
- spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb
|
339
314
|
- spec/fake_gem.rb
|
315
|
+
- spec/generators/views_generator_spec.rb
|
340
316
|
- spec/helpers/action_view_extension_spec.rb
|
341
317
|
- spec/helpers/helpers_spec.rb
|
342
318
|
- spec/helpers/sinatra_helpers_spec.rb
|
343
319
|
- spec/helpers/tags_spec.rb
|
344
320
|
- spec/models/active_record/active_record_relation_methods_spec.rb
|
345
|
-
- spec/models/active_record/
|
346
|
-
- spec/models/active_record/max_per_page_spec.rb
|
321
|
+
- spec/models/active_record/inherited_spec.rb
|
347
322
|
- spec/models/active_record/scopes_spec.rb
|
348
323
|
- spec/models/array_spec.rb
|
324
|
+
- spec/models/configuration_methods_spec.rb
|
349
325
|
- spec/models/data_mapper/data_mapper_spec.rb
|
350
326
|
- spec/models/mongo_mapper/mongo_mapper_spec.rb
|
351
327
|
- spec/models/mongoid/mongoid_spec.rb
|
data/gemfiles/mongoid_24.gemfile
DELETED
data/gemfiles/sinatra.gemfile
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
if defined? ActiveRecord
|
4
|
-
|
5
|
-
describe 'default per_page' do
|
6
|
-
describe 'AR::Base' do
|
7
|
-
subject { ActiveRecord::Base }
|
8
|
-
it { should_not respond_to :paginates_per }
|
9
|
-
end
|
10
|
-
|
11
|
-
subject { User.page 0 }
|
12
|
-
|
13
|
-
context 'by default' do
|
14
|
-
its(:limit_value) { should == 25 }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when explicitly set via paginates_per' do
|
18
|
-
before { User.paginates_per 1326 }
|
19
|
-
its(:limit_value) { should == 1326 }
|
20
|
-
after { User.paginates_per nil }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "default per_page value's independency per model" do
|
24
|
-
context "when User's default per_page was changed" do
|
25
|
-
before { User.paginates_per 1326 }
|
26
|
-
subject { Book.page 0 }
|
27
|
-
its(:limit_value) { should == 25 }
|
28
|
-
after { User.paginates_per nil }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
if defined? ActiveRecord
|
4
|
-
|
5
|
-
describe 'max per_page' do
|
6
|
-
describe 'AR::Base' do
|
7
|
-
subject { ActiveRecord::Base }
|
8
|
-
it { should_not respond_to :max_paginates_per }
|
9
|
-
end
|
10
|
-
|
11
|
-
subject { User.page(0).per(100) }
|
12
|
-
|
13
|
-
context 'by default' do
|
14
|
-
its(:limit_value) { should == 100 }
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when explicitly set via max_paginates_per' do
|
18
|
-
before { User.max_paginates_per 10 }
|
19
|
-
its(:limit_value) { should == 10 }
|
20
|
-
after { User.max_paginates_per nil }
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "max per_page value's independency per model" do
|
24
|
-
context "when User's max per_page was changed" do
|
25
|
-
before { User.max_paginates_per 10 }
|
26
|
-
subject { Book.page(0).per(100) }
|
27
|
-
its(:limit_value) { should == 100 }
|
28
|
-
after { User.max_paginates_per nil }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|