Skip to content

Commit c72e940

Browse files
committed
Test against both the will_paginate and the kaminari logic
Signed-off-by: David Celis <[email protected]>
1 parent cf8b936 commit c72e940

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ rvm:
33
- 1.9.3
44
- 2.0.0
55
script: bundle exec rspec
6+
env:
7+
- PAGINATOR=kaminari
8+
- PAGINATOR=will_paginate

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ source 'https://rubygems.org'
22

33
# Specify your gem's dependencies in api_pagination.gemspec
44
gemspec
5-
gem 'pry'

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,14 @@ Link: <http://localhost:3000/movies?page=1>; rel="first">,
8383
# ...
8484
```
8585

86-
While the above examples use [Kaminari][kaminari], api-pagination is also compatible with [will_paginate][will_paginate]. See either gem's README for more info on their respective usages.
87-
8886
## Contributing
8987

9088
1. Fork it
9189
2. Create your feature branch (`git checkout -b my-new-feature`)
92-
3. Commit your changes (`git commit -am 'Add some feature'`)
93-
4. Push to the branch (`git push origin my-new-feature`)
94-
5. Create a new Pull Request
90+
3. Commit your changes and tests (`git commit -am 'Add some feature'`)
91+
4. Run the tests (`KAMINARI=true bundle exec rspec; WILL_PAGINATE=true bundle exec rspec`)
92+
5. Push to the branch (`git push origin my-new-feature`)
93+
6. Create a new Pull Request
9594

9695
[kaminari]: https://github.com/amatsuda/kaminari
9796
[will_paginate]: https://github.com/mislav/will_paginate

lib/rails/pagination.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require 'pry'
21
module Rails
32
module Pagination
43
protected

spec/spec_helper.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
require 'rspec/autorun'
21
require 'support/numbers_controller'
3-
require 'api-pagination'
42
require 'support/numbers_api'
5-
6-
ApiPagination.kaminari = true
3+
require 'api-pagination'
74

85
# Quacks like Kaminari and will_paginate
96
PaginatedSet = Struct.new(:current_page, :per_page, :total_count) do
@@ -29,6 +26,9 @@ def paginate(options = {})
2926
end
3027
end
3128

29+
ApiPagination.kaminari = ENV['PAGINATOR'] == 'kaminari'
30+
ApiPagination.will_paginate = ENV['PAGINATOR'] == 'will_paginate'
31+
3232
RSpec.configure do |config|
3333
config.include Rack::Test::Methods
3434
config.include ControllerExampleGroup, :type => :controller

spec/support/numbers_api.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
require 'grape'
2+
require 'api-pagination'
3+
14
class NumbersAPI < Grape::API
25
format :json
36

0 commit comments

Comments
 (0)