We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cfd0946 + d9bab83 commit 4795c59Copy full SHA for 4795c59
lib/api-pagination/hooks.rb
@@ -1,7 +1,14 @@
1
begin; require 'grape'; rescue LoadError; end
2
if defined?(Grape::API)
3
require 'grape/pagination'
4
- Grape::API.send(:include, Grape::Pagination)
+
5
+ klass = if Grape::VERSION >= '1.2.0' || defined?(Grape::API::Instance)
6
+ Grape::API::Instance
7
+ else
8
+ Grape::API
9
+ end
10
11
+ klass.send(:include, Grape::Pagination)
12
end
13
14
begin; require 'pagy'; rescue LoadError; end
spec/grape_spec.rb
@@ -5,6 +5,8 @@
require 'support/shared_examples/last_page'
describe NumbersAPI do
+ it { is_expected.to be_kind_of(Grape::Pagination) }
describe 'GET #index' do
let(:link) { last_response.headers['Link'] }
let(:links) { link.split(', ') }
0 commit comments