kaminari 0.17.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +5 -5
  2. data/.codeclimate.yml +19 -0
  3. data/.github/workflows/main.yml +107 -0
  4. data/.gitignore +2 -1
  5. data/CHANGELOG.md +650 -0
  6. data/CONTRIBUTING.md +22 -0
  7. data/Gemfile +2 -0
  8. data/README.md +588 -0
  9. data/Rakefile +25 -25
  10. data/gemfiles/active_record_41.gemfile +17 -12
  11. data/gemfiles/active_record_42.gemfile +17 -12
  12. data/gemfiles/active_record_50.gemfile +26 -0
  13. data/gemfiles/active_record_51.gemfile +26 -0
  14. data/gemfiles/active_record_52.gemfile +26 -0
  15. data/gemfiles/active_record_60.gemfile +28 -0
  16. data/gemfiles/active_record_61.gemfile +28 -0
  17. data/gemfiles/active_record_70.gemfile +28 -0
  18. data/gemfiles/active_record_edge.gemfile +22 -17
  19. data/kaminari.gemspec +23 -27
  20. data/lib/kaminari/version.rb +3 -1
  21. data/lib/kaminari.rb +4 -38
  22. data/misc/bug_report_template.rb +57 -0
  23. metadata +54 -190
  24. data/.gemtest +0 -0
  25. data/.rspec +0 -2
  26. data/.travis.yml +0 -64
  27. data/CHANGELOG.rdoc +0 -480
  28. data/README.rdoc +0 -336
  29. data/app/views/kaminari/_first_page.html.erb +0 -11
  30. data/app/views/kaminari/_first_page.html.haml +0 -9
  31. data/app/views/kaminari/_first_page.html.slim +0 -10
  32. data/app/views/kaminari/_gap.html.erb +0 -8
  33. data/app/views/kaminari/_gap.html.haml +0 -8
  34. data/app/views/kaminari/_gap.html.slim +0 -9
  35. data/app/views/kaminari/_last_page.html.erb +0 -11
  36. data/app/views/kaminari/_last_page.html.haml +0 -9
  37. data/app/views/kaminari/_last_page.html.slim +0 -10
  38. data/app/views/kaminari/_next_page.html.erb +0 -11
  39. data/app/views/kaminari/_next_page.html.haml +0 -9
  40. data/app/views/kaminari/_next_page.html.slim +0 -10
  41. data/app/views/kaminari/_page.html.erb +0 -12
  42. data/app/views/kaminari/_page.html.haml +0 -10
  43. data/app/views/kaminari/_page.html.slim +0 -11
  44. data/app/views/kaminari/_paginator.html.erb +0 -23
  45. data/app/views/kaminari/_paginator.html.haml +0 -18
  46. data/app/views/kaminari/_paginator.html.slim +0 -19
  47. data/app/views/kaminari/_prev_page.html.erb +0 -11
  48. data/app/views/kaminari/_prev_page.html.haml +0 -9
  49. data/app/views/kaminari/_prev_page.html.slim +0 -10
  50. data/config/locales/kaminari.yml +0 -19
  51. data/gemfiles/active_record_30.gemfile +0 -28
  52. data/gemfiles/active_record_31.gemfile +0 -26
  53. data/gemfiles/active_record_32.gemfile +0 -25
  54. data/gemfiles/active_record_40.gemfile +0 -26
  55. data/gemfiles/data_mapper_12.gemfile +0 -32
  56. data/gemfiles/mongo_mapper.gemfile +0 -25
  57. data/gemfiles/mongoid_30.gemfile +0 -22
  58. data/gemfiles/mongoid_31.gemfile +0 -21
  59. data/gemfiles/mongoid_40.gemfile +0 -19
  60. data/gemfiles/mongoid_50.gemfile +0 -23
  61. data/gemfiles/sinatra_13.gemfile +0 -36
  62. data/gemfiles/sinatra_14.gemfile +0 -33
  63. data/lib/generators/kaminari/config_generator.rb +0 -16
  64. data/lib/generators/kaminari/templates/kaminari_config.rb +0 -10
  65. data/lib/generators/kaminari/views_generator.rb +0 -119
  66. data/lib/kaminari/config.rb +0 -51
  67. data/lib/kaminari/engine.rb +0 -4
  68. data/lib/kaminari/grape.rb +0 -4
  69. data/lib/kaminari/helpers/action_view_extension.rb +0 -132
  70. data/lib/kaminari/helpers/paginator.rb +0 -195
  71. data/lib/kaminari/helpers/sinatra_helpers.rb +0 -176
  72. data/lib/kaminari/helpers/tags.rb +0 -108
  73. data/lib/kaminari/hooks.rb +0 -53
  74. data/lib/kaminari/models/active_record_extension.rb +0 -22
  75. data/lib/kaminari/models/active_record_model_extension.rb +0 -22
  76. data/lib/kaminari/models/active_record_relation_methods.rb +0 -42
  77. data/lib/kaminari/models/array_extension.rb +0 -66
  78. data/lib/kaminari/models/configuration_methods.rb +0 -48
  79. data/lib/kaminari/models/data_mapper_collection_methods.rb +0 -19
  80. data/lib/kaminari/models/data_mapper_extension.rb +0 -51
  81. data/lib/kaminari/models/mongo_mapper_extension.rb +0 -18
  82. data/lib/kaminari/models/mongoid_criteria_methods.rb +0 -40
  83. data/lib/kaminari/models/mongoid_extension.rb +0 -26
  84. data/lib/kaminari/models/page_scope_methods.rb +0 -73
  85. data/lib/kaminari/models/plucky_criteria_methods.rb +0 -23
  86. data/lib/kaminari/railtie.rb +0 -7
  87. data/lib/kaminari/sinatra.rb +0 -7
  88. data/spec/config/config_spec.rb +0 -91
  89. data/spec/fake_app/active_record/config.rb +0 -3
  90. data/spec/fake_app/active_record/models.rb +0 -65
  91. data/spec/fake_app/data_mapper/config.rb +0 -1
  92. data/spec/fake_app/data_mapper/models.rb +0 -27
  93. data/spec/fake_app/mongo_mapper/config.rb +0 -2
  94. data/spec/fake_app/mongo_mapper/models.rb +0 -9
  95. data/spec/fake_app/mongoid/config.rb +0 -20
  96. data/spec/fake_app/mongoid/models.rb +0 -38
  97. data/spec/fake_app/rails_app.rb +0 -56
  98. data/spec/fake_app/sinatra_app.rb +0 -22
  99. data/spec/fake_app/views/alternative/kaminari/_first_page.html.erb +0 -1
  100. data/spec/fake_app/views/alternative/kaminari/_paginator.html.erb +0 -3
  101. data/spec/fake_app/views/kaminari/bootstrap/_page.html.erb +0 -1
  102. data/spec/fake_app/views/kaminari/bootstrap/_paginator.html.erb +0 -7
  103. data/spec/fake_gem.rb +0 -20
  104. data/spec/generators/views_generator_spec.rb +0 -18
  105. data/spec/helpers/action_view_extension_spec.rb +0 -318
  106. data/spec/helpers/helpers_spec.rb +0 -144
  107. data/spec/helpers/sinatra_helpers_spec.rb +0 -223
  108. data/spec/helpers/tags_spec.rb +0 -140
  109. data/spec/models/active_record/active_record_relation_methods_spec.rb +0 -77
  110. data/spec/models/active_record/inherited_spec.rb +0 -9
  111. data/spec/models/active_record/scopes_spec.rb +0 -265
  112. data/spec/models/array_spec.rb +0 -172
  113. data/spec/models/configuration_methods_spec.rb +0 -125
  114. data/spec/models/data_mapper/data_mapper_spec.rb +0 -205
  115. data/spec/models/mongo_mapper/mongo_mapper_spec.rb +0 -84
  116. data/spec/models/mongoid/mongoid_spec.rb +0 -228
  117. data/spec/requests/users_spec.rb +0 -53
  118. data/spec/spec_helper.rb +0 -34
  119. data/spec/spec_helper_for_sinatra.rb +0 -34
  120. data/spec/support/database_cleaner.rb +0 -19
  121. data/spec/support/matchers.rb +0 -52
@@ -1,7 +0,0 @@
1
- <div class="bootstrap-paginator">
2
- <%= paginator.render do -%>
3
- <% each_page do |page| %>
4
- <%= page_tag(page) -%>
5
- <% end %>
6
- <% end %>
7
- </div>
data/spec/fake_gem.rb DELETED
@@ -1,20 +0,0 @@
1
- module Kaminari
2
- module FakeGem
3
- extend ActiveSupport::Concern
4
-
5
- module ClassMethods
6
- def inherited(kls)
7
- super
8
- def kls.fake_gem_defined_method; end
9
- end
10
- end
11
- end
12
- end
13
-
14
- ActiveSupport.on_load :active_record do
15
- ActiveRecord::Base.send :include, Kaminari::FakeGem
16
-
17
- # Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
18
- class GemDefinedModel < ActiveRecord::Base
19
- end
20
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- if defined?(Rails)
4
- require 'rails/generators'
5
- require 'generators/kaminari/views_generator'
6
-
7
- describe Kaminari::Generators::GitHubApiHelper, :generator_spec => true do
8
- describe '.get_files_in_master' do
9
- subject { Kaminari::Generators::GitHubApiHelper.get_files_in_master }
10
- it { should include(["README", "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"]) }
11
- end
12
-
13
- describe '.get_content_for' do
14
- subject { Kaminari::Generators::GitHubApiHelper.get_content_for("README") }
15
- it { should == "" }
16
- end
17
- end
18
- end
@@ -1,318 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Kaminari::ActionViewExtension', :if => defined?(Rails)do
4
- describe '#paginate' do
5
- before do
6
- 50.times {|i| User.create! :name => "user#{i}"}
7
- @users = User.page(1)
8
- end
9
-
10
- subject { helper.paginate @users, :params => {:controller => 'users', :action => 'index'} }
11
- it { should be_a String }
12
-
13
- context 'escaping the pagination for javascript' do
14
- it 'should escape for javascript' do
15
- lambda { helper.escape_javascript(helper.paginate @users, :params => {:controller => 'users', :action => 'index'}) }.should_not raise_error
16
- end
17
- end
18
-
19
- context 'accepts :theme option' do
20
- before { helper.controller.append_view_path "spec/fake_app/views" }
21
- subject { helper.paginate @users, :theme => "bootstrap", :params => {:controller => 'users', :action => 'index'} }
22
- it { should match(/bootstrap-paginator/) }
23
- it { should match(/bootstrap-page-link/) }
24
- end
25
-
26
- context 'accepts :view_prefix option' do
27
- before { helper.controller.append_view_path "spec/fake_app/views" }
28
- subject { helper.paginate @users, :views_prefix => "alternative/", :params => {:controller => 'users', :action => 'index'} }
29
- it { should eq(" <b>1</b>\n") }
30
- end
31
-
32
- context "num_pages: 3" do
33
- subject { helper.paginate @users, :num_pages => 3, :params => {:controller => 'users', :action => 'index'} }
34
- it { should match(/<a href="\/users\?page=3">Last/) }
35
- end
36
- end
37
-
38
- describe '#link_to_previous_page' do
39
- before do
40
- 50.times {|i| User.create! :name => "user#{i}"}
41
- end
42
-
43
- context 'having previous pages' do
44
- before do
45
- @users = User.page(50)
46
- end
47
-
48
- context 'the default behaviour' do
49
- subject { helper.link_to_previous_page @users, 'Previous', :params => {:controller => 'users', :action => 'index'} }
50
- it { should be_a String }
51
- it { should match(/rel="previous"/) }
52
- end
53
-
54
- context 'overriding rel=' do
55
- subject { helper.link_to_previous_page @users, 'Previous', :rel => 'external', :params => {:controller => 'users', :action => 'index'} }
56
- it { should match(/rel="external"/) }
57
- end
58
- end
59
-
60
- context 'the first page' do
61
- before do
62
- @users = User.page(1)
63
- end
64
-
65
- subject { helper.link_to_previous_page @users, 'Previous', :params => {:controller => 'users', :action => 'index'} }
66
- it { should_not be }
67
- end
68
- end
69
-
70
- describe '#link_to_next_page' do
71
- before do
72
- 50.times {|i| User.create! :name => "user#{i}"}
73
- end
74
-
75
- context 'having more page' do
76
- before do
77
- @users = User.page(1)
78
- end
79
-
80
- context 'the default behaviour' do
81
- subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
82
- it { should be_a String }
83
- it { should match(/rel="next"/) }
84
- end
85
-
86
- context 'overriding rel=' do
87
- subject { helper.link_to_next_page @users, 'More', :rel => 'external', :params => {:controller => 'users', :action => 'index'} }
88
- it { should match(/rel="external"/) }
89
- end
90
- end
91
-
92
- context 'the last page' do
93
- before do
94
- @users = User.page(2)
95
- end
96
-
97
- subject { helper.link_to_next_page @users, 'More', :params => {:controller => 'users', :action => 'index'} }
98
- it { should_not be }
99
- end
100
- end
101
-
102
- describe '#page_entries_info' do
103
- context 'on a model without namespace' do
104
- before do
105
- @users = User.page(1).per(25)
106
- end
107
-
108
- context 'having no entries' do
109
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
110
- it { should == 'No users found' }
111
-
112
- context 'setting the entry name option to "member"' do
113
- subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
114
- it { should == 'No members found' }
115
- end
116
- end
117
-
118
- context 'having 1 entry' do
119
- before do
120
- User.create! :name => 'user1'
121
- @users = User.page(1).per(25)
122
- end
123
-
124
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
125
- it { should == 'Displaying <b>1</b> user' }
126
-
127
- context 'setting the entry name option to "member"' do
128
- subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
129
- it { should == 'Displaying <b>1</b> member' }
130
- end
131
- end
132
-
133
- context 'having more than 1 but less than a page of entries' do
134
- before do
135
- 10.times {|i| User.create! :name => "user#{i}"}
136
- @users = User.page(1).per(25)
137
- end
138
-
139
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
140
- it { should == 'Displaying <b>all 10</b> users' }
141
-
142
- context 'setting the entry name option to "member"' do
143
- subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
144
- it { should == 'Displaying <b>all 10</b> members' }
145
- end
146
- end
147
-
148
- context 'having more than one page of entries' do
149
- before do
150
- 50.times {|i| User.create! :name => "user#{i}"}
151
- end
152
-
153
- describe 'the first page' do
154
- before do
155
- @users = User.page(1).per(25)
156
- end
157
-
158
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
159
- it { should == 'Displaying users <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
160
-
161
- context 'setting the entry name option to "member"' do
162
- subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
163
- it { should == 'Displaying members <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
164
- end
165
- end
166
-
167
- describe 'the next page' do
168
- before do
169
- @users = User.page(2).per(25)
170
- end
171
-
172
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
173
- it { should == 'Displaying users <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
174
-
175
- context 'setting the entry name option to "member"' do
176
- subject { helper.page_entries_info @users, :entry_name => 'member', :params => {:controller => 'users', :action => 'index'} }
177
- it { should == 'Displaying members <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
178
- end
179
- end
180
-
181
- describe 'the last page' do
182
- before do
183
- User.max_pages_per 4
184
- @users = User.page(4).per(10)
185
- end
186
-
187
- after { User.max_pages_per nil }
188
-
189
- subject { helper.page_entries_info @users, :params => {:controller => 'users', :action => 'index'} }
190
- it { should == 'Displaying users <b>31&nbsp;-&nbsp;40</b> of <b>50</b> in total' }
191
- end
192
- end
193
- end
194
- context 'on a model with namespace' do
195
- before do
196
- @addresses = User::Address.page(1).per(25)
197
- end
198
-
199
- context 'having no entries' do
200
- subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
201
- it { should == 'No addresses found' }
202
- end
203
-
204
- context 'having 1 entry' do
205
- before do
206
- User::Address.create!
207
- @addresses = User::Address.page(1).per(25)
208
- end
209
-
210
- subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
211
- it { should == 'Displaying <b>1</b> address' }
212
-
213
- context 'setting the entry name option to "place"' do
214
- subject { helper.page_entries_info @addresses, :entry_name => 'place', :params => {:controller => 'addresses', :action => 'index'} }
215
- it { should == 'Displaying <b>1</b> place' }
216
- end
217
- end
218
-
219
- context 'having more than 1 but less than a page of entries' do
220
- before do
221
- 10.times {|i| User::Address.create!}
222
- @addresses = User::Address.page(1).per(25)
223
- end
224
-
225
- subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
226
- it { should == 'Displaying <b>all 10</b> addresses' }
227
-
228
- context 'setting the entry name option to "place"' do
229
- subject { helper.page_entries_info @addresses, :entry_name => 'place', :params => {:controller => 'addresses', :action => 'index'} }
230
- it { should == 'Displaying <b>all 10</b> places' }
231
- end
232
- end
233
-
234
- context 'having more than one page of entries' do
235
- before do
236
- 50.times {|i| User::Address.create!}
237
- end
238
-
239
- describe 'the first page' do
240
- before do
241
- @addresses = User::Address.page(1).per(25)
242
- end
243
-
244
- subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
245
- it { should == 'Displaying addresses <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
246
-
247
- context 'setting the entry name option to "place"' do
248
- subject { helper.page_entries_info @addresses, :entry_name => 'place', :params => {:controller => 'addresses', :action => 'index'} }
249
- it { should == 'Displaying places <b>1&nbsp;-&nbsp;25</b> of <b>50</b> in total' }
250
- end
251
- end
252
-
253
- describe 'the next page' do
254
- before do
255
- @addresses = User::Address.page(2).per(25)
256
- end
257
-
258
- subject { helper.page_entries_info @addresses, :params => {:controller => 'addresses', :action => 'index'} }
259
- it { should == 'Displaying addresses <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
260
-
261
- context 'setting the entry name option to "place"' do
262
- subject { helper.page_entries_info @addresses, :entry_name => 'place', :params => {:controller => 'addresses', :action => 'index'} }
263
- it { should == 'Displaying places <b>26&nbsp;-&nbsp;50</b> of <b>50</b> in total' }
264
- end
265
- end
266
- end
267
- end
268
-
269
- context 'on a PaginatableArray' do
270
- before do
271
- @numbers = Kaminari.paginate_array(%w{one two three}).page(1)
272
- end
273
-
274
- subject { helper.page_entries_info @numbers }
275
- it { should == 'Displaying <b>all 3</b> entries' }
276
- end
277
- end
278
-
279
- describe '#rel_next_prev_link_tags' do
280
- before do
281
- 80.times {|i| User.create! :name => "user#{i}"}
282
- end
283
-
284
- context 'the first page' do
285
- before do
286
- @users = User.page(1).per(25)
287
- end
288
-
289
- subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} }
290
- it { should_not match(/rel="prev"/) }
291
- it { should match(/rel="next"/) }
292
- it { should match(/\?page=2/) }
293
- end
294
-
295
- context 'the middle page' do
296
- before do
297
- @users = User.page(3).per(25)
298
- end
299
-
300
- subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} }
301
- it { should match(/rel="prev"/) }
302
- it { should match(/\?page=2/) }
303
- it { should match(/rel="next"/) }
304
- it { should match(/\?page=4/) }
305
- end
306
-
307
- context 'the last page' do
308
- before do
309
- @users = User.page(4).per(25)
310
- end
311
-
312
- subject { helper.rel_next_prev_link_tags @users, :params => {:controller => 'users', :action => 'index'} }
313
- it { should match(/rel="prev"/) }
314
- it { should match(/\?page=3"/) }
315
- it { should_not match(/rel="next"/) }
316
- end
317
- end
318
- end
@@ -1,144 +0,0 @@
1
- require 'spec_helper'
2
- include Kaminari::Helpers
3
-
4
- describe 'Kaminari::Helpers::Paginator' do
5
- let :template do
6
- stub(r = Object.new) do
7
- render.with_any_args
8
- params { {} }
9
- options { {} }
10
- url_for {|h| "/foo?page=#{h[:page]}"}
11
- link_to { "<a href='#'>link</a>" }
12
- end
13
- r
14
- end
15
-
16
- describe "view helper methods delegated to template" do
17
- before do
18
- @paginator = Paginator.new(template, :params => {})
19
- end
20
- subject { @paginator.link_to("link", "#") }
21
- it { should == "<a href='#'>link</a>" }
22
- end
23
-
24
- describe '#params' do
25
- before do
26
- @paginator = Paginator.new(template, :params => {:controller => 'foo', :action => 'bar'})
27
- end
28
- subject { @paginator.page_tag(template).instance_variable_get('@params') }
29
- it { should == {:controller => 'foo', :action => 'bar'} }
30
- end
31
-
32
- describe '#param_name' do
33
- before do
34
- @paginator = Paginator.new(template, :param_name => :pagina)
35
- end
36
- subject { @paginator.page_tag(template).instance_variable_get('@param_name') }
37
- it { should == :pagina }
38
- end
39
-
40
- #TODO test somehow...
41
- # describe '#tagify_links' do
42
- # def tags_with(options)
43
- # PaginationRenderer.new(template, options).tagify_links
44
- # end
45
-
46
- # context '1 page in total' do
47
- # subject { tags_with :total_pages => 1, :current_page => 1 }
48
- # it { should have(0).tags }
49
- # end
50
-
51
- # context '10 pages in total' do
52
- # context 'first page' do
53
- # subject { tags_with :total_pages => 10, :current_page => 1 }
54
- # it { should_not contain_tag PrevLink }
55
- # it { should contain_tag PrevSpan }
56
- # it { should contain_tag CurrentPage }
57
- # it { should_not contain_tag FirstPageLink }
58
- # it { should contain_tag LastPageLink }
59
- # it { should contain_tag PageLink }
60
- # it { should contain_tag NextLink }
61
- # it { should_not contain_tag NextSpan }
62
- # it { should contain_tag TruncatedSpan }
63
- # end
64
-
65
- # context 'second page' do
66
- # subject { tags_with :total_pages => 10, :current_page => 2 }
67
- # it { should contain_tag PrevLink }
68
- # it { should_not contain_tag PrevSpan }
69
- # it { should contain_tag CurrentPage }
70
- # it { should contain_tag FirstPageLink }
71
- # it { should contain_tag LastPageLink }
72
- # it { should contain_tag PageLink }
73
- # it { should contain_tag NextLink }
74
- # it { should_not contain_tag NextSpan }
75
- # it { should contain_tag TruncatedSpan }
76
- # end
77
-
78
- # context 'third page' do
79
- # subject { tags_with :total_pages => 10, :current_page => 3 }
80
- # it { should contain_tag PrevLink }
81
- # it { should_not contain_tag PrevSpan }
82
- # it { should contain_tag CurrentPage }
83
- # it { should contain_tag FirstPageLink }
84
- # it { should contain_tag LastPageLink }
85
- # it { should contain_tag PageLink }
86
- # it { should contain_tag NextLink }
87
- # it { should_not contain_tag NextSpan }
88
- # it { should contain_tag TruncatedSpan }
89
- # end
90
-
91
- # context 'fourth page(no truncation)' do
92
- # subject { tags_with :total_pages => 10, :current_page => 4 }
93
- # it { should contain_tag PrevLink }
94
- # it { should_not contain_tag PrevSpan }
95
- # it { should contain_tag CurrentPage }
96
- # it { should contain_tag FirstPageLink }
97
- # it { should contain_tag LastPageLink }
98
- # it { should contain_tag PageLink }
99
- # it { should contain_tag NextLink }
100
- # it { should_not contain_tag NextSpan }
101
- # it { should_not contain_tag TruncatedSpan }
102
- # end
103
-
104
- # context 'seventh page(no truncation)' do
105
- # subject { tags_with :total_pages => 10, :current_page => 7 }
106
- # it { should contain_tag PrevLink }
107
- # it { should_not contain_tag PrevSpan }
108
- # it { should contain_tag CurrentPage }
109
- # it { should contain_tag FirstPageLink }
110
- # it { should contain_tag LastPageLink }
111
- # it { should contain_tag PageLink }
112
- # it { should contain_tag NextLink }
113
- # it { should_not contain_tag NextSpan }
114
- # it { should_not contain_tag TruncatedSpan }
115
- # end
116
-
117
- # context 'eighth page' do
118
- # subject { tags_with :total_pages => 10, :current_page => 8 }
119
- # it { should contain_tag PrevLink }
120
- # it { should_not contain_tag PrevSpan }
121
- # it { should contain_tag CurrentPage }
122
- # it { should contain_tag FirstPageLink }
123
- # it { should contain_tag LastPageLink }
124
- # it { should contain_tag PageLink }
125
- # it { should contain_tag NextLink }
126
- # it { should_not contain_tag NextSpan }
127
- # it { should contain_tag TruncatedSpan }
128
- # end
129
-
130
- # context 'last page' do
131
- # subject { tags_with :total_pages => 10, :current_page => 10 }
132
- # it { should contain_tag PrevLink }
133
- # it { should_not contain_tag PrevSpan }
134
- # it { should contain_tag CurrentPage }
135
- # it { should contain_tag FirstPageLink }
136
- # it { should_not contain_tag LastPageLink }
137
- # it { should contain_tag PageLink }
138
- # it { should_not contain_tag NextLink }
139
- # it { should contain_tag NextSpan }
140
- # it { should contain_tag TruncatedSpan }
141
- # end
142
- # end
143
- # end
144
- end