kaminari 0.14.1 → 0.15.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/.coveralls.yml +1 -0
- data/.document +1 -4
- data/.gitignore +1 -0
- data/.travis.yml +23 -5
- data/CHANGELOG +33 -0
- data/Gemfile +1 -1
- data/README.rdoc +40 -22
- data/Rakefile +2 -2
- 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 +5 -3
- data/gemfiles/active_record_31.gemfile +3 -3
- data/gemfiles/active_record_32.gemfile +6 -3
- data/gemfiles/active_record_40.gemfile +7 -0
- data/gemfiles/active_record_edge.gemfile +11 -0
- data/gemfiles/data_mapper_12.gemfile +10 -7
- data/gemfiles/mongo_mapper.gemfile +4 -1
- data/gemfiles/mongoid_24.gemfile +1 -1
- data/gemfiles/mongoid_30.gemfile +7 -2
- data/gemfiles/mongoid_31.gemfile +12 -0
- data/gemfiles/sinatra_13.gemfile +15 -0
- data/gemfiles/sinatra_14.gemfile +15 -0
- data/kaminari.gemspec +4 -4
- data/lib/kaminari/config.rb +2 -0
- data/lib/kaminari/helpers/action_view_extension.rb +1 -2
- data/lib/kaminari/helpers/paginator.rb +23 -12
- data/lib/kaminari/helpers/sinatra_helpers.rb +7 -1
- data/lib/kaminari/helpers/tags.rb +1 -1
- data/lib/kaminari/models/active_record_model_extension.rb +7 -5
- data/lib/kaminari/models/active_record_relation_methods.rb +12 -10
- data/lib/kaminari/models/array_extension.rb +4 -6
- data/lib/kaminari/models/configuration_methods.rb +16 -2
- data/lib/kaminari/models/data_mapper_extension.rb +5 -2
- data/lib/kaminari/models/page_scope_methods.rb +32 -3
- data/lib/kaminari/models/plucky_criteria_methods.rb +2 -1
- 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/models.rb +8 -0
- data/spec/fake_app/rails_app.rb +1 -0
- data/spec/helpers/action_view_extension_spec.rb +2 -2
- data/spec/models/active_record/active_record_relation_methods_spec.rb +42 -1
- data/spec/models/active_record/scopes_spec.rb +79 -2
- data/spec/models/array_spec.rb +29 -0
- data/spec/models/configuration_methods_spec.rb +125 -0
- data/spec/models/data_mapper/data_mapper_spec.rb +52 -0
- data/spec/models/mongo_mapper/mongo_mapper_spec.rb +12 -0
- data/spec/models/mongoid/mongoid_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/spec_helper_for_sinatra.rb +2 -3
- data/spec/support/database_cleaner.rb +5 -2
- metadata +50 -73
- 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
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "configuration methods" do
|
4
|
+
let(:model){ User }
|
5
|
+
|
6
|
+
describe "#default_per_page" do
|
7
|
+
if defined? ActiveRecord
|
8
|
+
describe 'AR::Base' do
|
9
|
+
subject { ActiveRecord::Base }
|
10
|
+
it { should_not respond_to :paginates_per }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
subject { model.page(1) }
|
15
|
+
|
16
|
+
context "by default" do
|
17
|
+
its(:limit_value){ should == 25 }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "when configuring both on global and model-level" do
|
21
|
+
before do
|
22
|
+
Kaminari.configure {|c| c.default_per_page = 50 }
|
23
|
+
model.paginates_per 100
|
24
|
+
end
|
25
|
+
|
26
|
+
its(:limit_value){ should == 100 }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when configuring multiple times" do
|
30
|
+
before do
|
31
|
+
Kaminari.configure {|c| c.default_per_page = 10 }
|
32
|
+
Kaminari.configure {|c| c.default_per_page = 20 }
|
33
|
+
end
|
34
|
+
|
35
|
+
its(:limit_value){ should == 20 }
|
36
|
+
end
|
37
|
+
|
38
|
+
after do
|
39
|
+
Kaminari.configure {|c| c.default_per_page = 25 }
|
40
|
+
model.paginates_per nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#max_per_page" do
|
45
|
+
if defined? ActiveRecord
|
46
|
+
describe 'AR::Base' do
|
47
|
+
subject { ActiveRecord::Base }
|
48
|
+
it { should_not respond_to :max_pages_per }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
subject { model.page(1).per(1000) }
|
53
|
+
|
54
|
+
context "by default" do
|
55
|
+
its(:limit_value){ should == 1000 }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when configuring both on global and model-level" do
|
59
|
+
before do
|
60
|
+
Kaminari.configure {|c| c.max_per_page = 50 }
|
61
|
+
model.max_paginates_per 100
|
62
|
+
end
|
63
|
+
|
64
|
+
its(:limit_value){ should == 100 }
|
65
|
+
end
|
66
|
+
|
67
|
+
context "when configuring multiple times" do
|
68
|
+
before do
|
69
|
+
Kaminari.configure {|c| c.max_per_page = 10 }
|
70
|
+
Kaminari.configure {|c| c.max_per_page = 20 }
|
71
|
+
end
|
72
|
+
|
73
|
+
its(:limit_value){ should == 20 }
|
74
|
+
end
|
75
|
+
|
76
|
+
after do
|
77
|
+
Kaminari.configure {|c| c.max_per_page = nil }
|
78
|
+
model.max_paginates_per nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#max_pages" do
|
83
|
+
if defined? ActiveRecord
|
84
|
+
describe 'AR::Base' do
|
85
|
+
subject { ActiveRecord::Base }
|
86
|
+
it { should_not respond_to :max_paginates_per }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
before do
|
91
|
+
100.times do |count|
|
92
|
+
model.create!(:name => "User#{count}")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
subject { model.page(1).per(5) }
|
97
|
+
|
98
|
+
context "by default" do
|
99
|
+
its(:total_pages){ should == 20 }
|
100
|
+
end
|
101
|
+
|
102
|
+
context "when configuring both on global and model-level" do
|
103
|
+
before do
|
104
|
+
Kaminari.configure {|c| c.max_pages = 10 }
|
105
|
+
model.max_pages_per 15
|
106
|
+
end
|
107
|
+
|
108
|
+
its(:total_pages){ should == 15 }
|
109
|
+
end
|
110
|
+
|
111
|
+
context "when configuring multiple times" do
|
112
|
+
before do
|
113
|
+
Kaminari.configure {|c| c.max_pages = 10 }
|
114
|
+
Kaminari.configure {|c| c.max_pages = 15 }
|
115
|
+
end
|
116
|
+
|
117
|
+
its(:total_pages){ should == 15 }
|
118
|
+
end
|
119
|
+
|
120
|
+
after do
|
121
|
+
Kaminari.configure {|c| c.max_pages = nil }
|
122
|
+
model.max_pages_per nil
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -1,6 +1,34 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
if defined? DataMapper
|
4
|
+
# tests for issue #203
|
5
|
+
describe Kaminari::DataMapperCollectionMethods do
|
6
|
+
before do
|
7
|
+
100.times do |i|
|
8
|
+
User.create(:name => "User#{i}", :age => i)
|
9
|
+
end
|
10
|
+
|
11
|
+
worker0 = User[0]
|
12
|
+
50.times do |i|
|
13
|
+
worker0.projects << Project.create(:name => "Project#{i}")
|
14
|
+
end
|
15
|
+
worker0.projects.save
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'Model' do
|
19
|
+
subject { User }
|
20
|
+
it { User.all.count.should == 100 }
|
21
|
+
it { User.page(1).length.should == 25 }
|
22
|
+
it {
|
23
|
+
User.paginates_per(5)
|
24
|
+
User.page(1).length.should == 5
|
25
|
+
User.all.page(1).length.should == 5
|
26
|
+
User.paginates_per(nil) # reset to default
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
4
32
|
describe Kaminari::DataMapperExtension do
|
5
33
|
before do
|
6
34
|
100.times do |i|
|
@@ -32,6 +60,8 @@ if defined? DataMapper
|
|
32
60
|
subject { User.all(:age.gte => 60).page 0 }
|
33
61
|
it { should be_a DataMapper::Collection }
|
34
62
|
its(:current_page) { should == 1 }
|
63
|
+
its(:prev_page) { should be_nil }
|
64
|
+
its(:next_page) { should == 2 }
|
35
65
|
its('query.limit') { should == 25 }
|
36
66
|
its('query.offset') { should == 0 }
|
37
67
|
its(:total_count) { should == User.count(:age.gte => 60) }
|
@@ -42,6 +72,8 @@ if defined? DataMapper
|
|
42
72
|
subject { User.all(:age.gte => 0).page 1 }
|
43
73
|
it { should be_a DataMapper::Collection }
|
44
74
|
its(:current_page) { should == 1 }
|
75
|
+
its(:prev_page) { should be_nil }
|
76
|
+
its(:next_page) { should == 2 }
|
45
77
|
its('query.limit') { should == 25 }
|
46
78
|
its('query.offset') { should == 0 }
|
47
79
|
its(:total_count) { should == 100 }
|
@@ -52,6 +84,8 @@ if defined? DataMapper
|
|
52
84
|
subject { User.page 2 }
|
53
85
|
it { should be_a DataMapper::Collection }
|
54
86
|
its(:current_page) { should == 2 }
|
87
|
+
its(:prev_page) { should == 1 }
|
88
|
+
its(:next_page) { should == 3 }
|
55
89
|
its(:limit_value) { should == 25 }
|
56
90
|
its('query.limit') { should == 25 }
|
57
91
|
its('query.offset') { should == 25 }
|
@@ -63,6 +97,8 @@ if defined? DataMapper
|
|
63
97
|
subject { User.page 'foobar' }
|
64
98
|
it { should be_a DataMapper::Collection }
|
65
99
|
its(:current_page) { should == 1 }
|
100
|
+
its(:prev_page) { should be_nil }
|
101
|
+
its(:next_page) { should == 2 }
|
66
102
|
its('query.limit') { should == 25 }
|
67
103
|
its('query.offset') { should == 0 }
|
68
104
|
its(:total_count) { should == 100 }
|
@@ -73,6 +109,8 @@ if defined? DataMapper
|
|
73
109
|
subject { User.all(:age.gt => 60).page 2 }
|
74
110
|
it { should be_a DataMapper::Collection }
|
75
111
|
its(:current_page) { should == 2 }
|
112
|
+
its(:prev_page) { should == 1 }
|
113
|
+
its(:next_page) { should be_nil }
|
76
114
|
its('query.limit') { should == 25 }
|
77
115
|
its('query.offset') { should == 25 }
|
78
116
|
its(:total_count) { should == User.count(:age.gt => 60) }
|
@@ -83,6 +121,8 @@ if defined? DataMapper
|
|
83
121
|
subject { User.page(2).all(:age.gt => 60) }
|
84
122
|
it { should be_a DataMapper::Collection }
|
85
123
|
its(:current_page) { should == 2 }
|
124
|
+
its(:prev_page) { should == 1 }
|
125
|
+
its(:next_page) { should be_nil }
|
86
126
|
its('query.limit') { should == 25 }
|
87
127
|
its('query.offset') { should == 25 }
|
88
128
|
its(:total_count) { should == User.count(:age.gt => 60) }
|
@@ -95,6 +135,8 @@ if defined? DataMapper
|
|
95
135
|
subject { User.page(2).per(20) }
|
96
136
|
it { should be_a DataMapper::Collection }
|
97
137
|
its(:current_page) { should == 2 }
|
138
|
+
its(:prev_page) { should == 1 }
|
139
|
+
its(:next_page) { should == 3 }
|
98
140
|
its('query.limit') { should == 20 }
|
99
141
|
its(:limit_value) { should == 20 }
|
100
142
|
its('query.offset') { should == 20 }
|
@@ -105,6 +147,8 @@ if defined? DataMapper
|
|
105
147
|
context 'on query with condition' do
|
106
148
|
subject { User.page(5).all(:age.lte => 80).per(13) }
|
107
149
|
its(:current_page) { should == 5 }
|
150
|
+
its(:prev_page) { should == 4 }
|
151
|
+
its(:next_page) { should == 6 }
|
108
152
|
its('query.limit') { should == 13 }
|
109
153
|
its('query.offset') { should == 52 }
|
110
154
|
its(:total_count) { should == 81 }
|
@@ -118,6 +162,8 @@ if defined? DataMapper
|
|
118
162
|
it('includes user with age 52') { should include(User.first(:age => 64)) }
|
119
163
|
it('does not include user with age 51') { should_not include(User.first(:age => 65)) }
|
120
164
|
its(:current_page) { should == 5 }
|
165
|
+
its(:prev_page) { should == 4 }
|
166
|
+
its(:next_page) { should == 6 }
|
121
167
|
its('query.limit') { should == 13 }
|
122
168
|
its('query.offset') { should == 52 }
|
123
169
|
its(:total_count) { should == 81 }
|
@@ -127,6 +173,8 @@ if defined? DataMapper
|
|
127
173
|
context 'on chained queries' do
|
128
174
|
subject { User.all(:age.gte => 50).page(3).all(:age.lte => 80).per(13) }
|
129
175
|
its(:current_page) { should == 3 }
|
176
|
+
its(:prev_page) { should == 2 }
|
177
|
+
its(:next_page) { should be_nil }
|
130
178
|
its('query.limit') { should == 13 }
|
131
179
|
its('query.offset') { should == 26 }
|
132
180
|
its(:total_count) { should == 31 }
|
@@ -136,6 +184,8 @@ if defined? DataMapper
|
|
136
184
|
context 'on query on association' do
|
137
185
|
subject { User[0].projects.page(3).all(:name.like => 'Project%').per(5) }
|
138
186
|
its(:current_page) { should == 3 }
|
187
|
+
its(:prev_page) { should == 2 }
|
188
|
+
its(:next_page) { should == 4 }
|
139
189
|
its('query.limit') { should == 5 }
|
140
190
|
its('query.offset') { should == 10 }
|
141
191
|
its(:total_count) { should == 50 }
|
@@ -145,6 +195,8 @@ if defined? DataMapper
|
|
145
195
|
context 'on query with association conditions' do
|
146
196
|
subject { User.page(3).all(:projects => Project.all).per(5) }
|
147
197
|
its(:current_page) { should == 3 }
|
198
|
+
its(:prev_page) { should == 2 }
|
199
|
+
its(:next_page) { should == 4 }
|
148
200
|
its('query.limit') { should == 5 }
|
149
201
|
its('query.offset') { should == 10 }
|
150
202
|
its(:total_count) { should == 50 }
|
@@ -12,6 +12,8 @@ if defined? MongoMapper
|
|
12
12
|
subject { User.page(1) }
|
13
13
|
it { should be_a Plucky::Query }
|
14
14
|
its(:current_page) { should == 1 }
|
15
|
+
its(:prev_page) { should be_nil }
|
16
|
+
its(:next_page) { should == 2 }
|
15
17
|
its(:limit_value) { should == 25 }
|
16
18
|
its(:total_pages) { should == 2 }
|
17
19
|
it { should skip(0) }
|
@@ -21,6 +23,8 @@ if defined? MongoMapper
|
|
21
23
|
subject { User.page 2 }
|
22
24
|
it { should be_a Plucky::Query }
|
23
25
|
its(:current_page) { should == 2 }
|
26
|
+
its(:prev_page) { should == 1 }
|
27
|
+
its(:next_page) { should be_nil }
|
24
28
|
its(:limit_value) { should == 25 }
|
25
29
|
its(:total_pages) { should == 2 }
|
26
30
|
it { should skip 25 }
|
@@ -30,6 +34,8 @@ if defined? MongoMapper
|
|
30
34
|
subject { User.page 'foobar' }
|
31
35
|
it { should be_a Plucky::Query }
|
32
36
|
its(:current_page) { should == 1 }
|
37
|
+
its(:prev_page) { should be_nil }
|
38
|
+
its(:next_page) { should == 2 }
|
33
39
|
its(:limit_value) { should == 25 }
|
34
40
|
its(:total_pages) { should == 2 }
|
35
41
|
it { should skip 0 }
|
@@ -42,6 +48,8 @@ if defined? MongoMapper
|
|
42
48
|
|
43
49
|
subject { User.where(:salary => 1).page 2 }
|
44
50
|
its(:current_page) { should == 2 }
|
51
|
+
its(:prev_page) { should == 1 }
|
52
|
+
its(:next_page) { should be_nil }
|
45
53
|
its(:limit_value) { should == 25 }
|
46
54
|
its(:total_pages) { should == 2 }
|
47
55
|
it { should skip 25 }
|
@@ -54,6 +62,8 @@ if defined? MongoMapper
|
|
54
62
|
|
55
63
|
subject { User.page(2).where(:salary => 1) }
|
56
64
|
its(:current_page) { should == 2 }
|
65
|
+
its(:prev_page) { should == 1 }
|
66
|
+
its(:next_page) { should be_nil }
|
57
67
|
its(:limit_value) { should == 25 }
|
58
68
|
its(:total_pages) { should == 2 }
|
59
69
|
it { should skip 25 }
|
@@ -64,6 +74,8 @@ if defined? MongoMapper
|
|
64
74
|
subject { User.page(2).per(10) }
|
65
75
|
it { should be_a Plucky::Query }
|
66
76
|
its(:current_page) { should == 2 }
|
77
|
+
its(:prev_page) { should == 1 }
|
78
|
+
its(:next_page) { should == 3 }
|
67
79
|
its(:limit_value) { should == 10 }
|
68
80
|
its(:total_pages) { should == 5 }
|
69
81
|
it { should skip 10 }
|
@@ -14,6 +14,8 @@ if defined? Mongoid
|
|
14
14
|
subject { User.page 1 }
|
15
15
|
it { should be_a Mongoid::Criteria }
|
16
16
|
its(:current_page) { should == 1 }
|
17
|
+
its(:prev_page) { should be_nil }
|
18
|
+
its(:next_page) { should == 2 }
|
17
19
|
its(:limit_value) { should == 25 }
|
18
20
|
its(:total_pages) { should == 2 }
|
19
21
|
it { should skip(0) }
|
@@ -23,6 +25,8 @@ if defined? Mongoid
|
|
23
25
|
subject { User.page 2 }
|
24
26
|
it { should be_a Mongoid::Criteria }
|
25
27
|
its(:current_page) { should == 2 }
|
28
|
+
its(:prev_page) { should == 1 }
|
29
|
+
its(:next_page) { should be_nil }
|
26
30
|
its(:limit_value) { should == 25 }
|
27
31
|
its(:total_pages) { should == 2 }
|
28
32
|
it { should skip 25 }
|
@@ -32,6 +36,8 @@ if defined? Mongoid
|
|
32
36
|
subject { User.page 'foobar' }
|
33
37
|
it { should be_a Mongoid::Criteria }
|
34
38
|
its(:current_page) { should == 1 }
|
39
|
+
its(:prev_page) { should be_nil }
|
40
|
+
its(:next_page) { should == 2 }
|
35
41
|
its(:limit_value) { should == 25 }
|
36
42
|
its(:total_pages) { should == 2 }
|
37
43
|
it { should skip 0 }
|
@@ -44,6 +50,8 @@ if defined? Mongoid
|
|
44
50
|
its(:selector) { should == {:salary => 1} }
|
45
51
|
end
|
46
52
|
its(:current_page) { should == 2 }
|
53
|
+
its(:prev_page) { should == 1 }
|
54
|
+
its(:next_page) { should be_nil }
|
47
55
|
its(:limit_value) { should == 25 }
|
48
56
|
its(:total_pages) { should == 2 }
|
49
57
|
it { should skip 25 }
|
@@ -64,6 +72,8 @@ if defined? Mongoid
|
|
64
72
|
subject { User.page(2).per(10) }
|
65
73
|
it { should be_a Mongoid::Criteria }
|
66
74
|
its(:current_page) { should == 2 }
|
75
|
+
its(:prev_page) { should == 1 }
|
76
|
+
its(:next_page) { should == 3 }
|
67
77
|
its(:limit_value) { should == 10 }
|
68
78
|
its(:total_pages) { should == 5 }
|
69
79
|
it { should skip 10 }
|
@@ -85,6 +95,8 @@ if defined? Mongoid
|
|
85
95
|
its(:total_count) { should == 5 }
|
86
96
|
its(:limit_value) { should == 1 }
|
87
97
|
its(:current_page) { should == 1 }
|
98
|
+
its(:prev_page) { should be_nil }
|
99
|
+
its(:next_page) { should == 2 }
|
88
100
|
its(:total_pages) { should == 5 }
|
89
101
|
end
|
90
102
|
|
@@ -94,6 +106,8 @@ if defined? Mongoid
|
|
94
106
|
its(:total_count) { should == 3 }
|
95
107
|
its(:limit_value) { should == 2 }
|
96
108
|
its(:current_page) { should == 1 }
|
109
|
+
its(:prev_page) { should be_nil }
|
110
|
+
its(:next_page) { should == 2 }
|
97
111
|
its(:total_pages) { should == 2 }
|
98
112
|
end
|
99
113
|
|
@@ -103,6 +117,8 @@ if defined? Mongoid
|
|
103
117
|
its(:total_count) { should == 3 }
|
104
118
|
its(:limit_value) { should == 2 }
|
105
119
|
its(:current_page) { should == 1 }
|
120
|
+
its(:prev_page) { should be_nil }
|
121
|
+
its(:next_page) { should == 2 }
|
106
122
|
its(:total_pages) { should == 2 }
|
107
123
|
end
|
108
124
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -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
|