Skip to content
Permalink
Browse files

Add compatibility with Grape >= 1.2.0

  • Loading branch information...
fotos committed Dec 7, 2018
1 parent cfd0946 commit d9bab83729752773b989fa5b3287bbe869198b81
Showing with 10 additions and 1 deletion.
  1. +8 −1 lib/api-pagination/hooks.rb
  2. +2 −0 spec/grape_spec.rb
@@ -1,7 +1,14 @@
begin; require 'grape'; rescue LoadError; end
if defined?(Grape::API)
require 'grape/pagination'
Grape::API.send(:include, Grape::Pagination)

klass = if Grape::VERSION >= '1.2.0' || defined?(Grape::API::Instance)
Grape::API::Instance
else
Grape::API
end

klass.send(:include, Grape::Pagination)
end

begin; require 'pagy'; rescue LoadError; end
@@ -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 comments on commit d9bab83

Please sign in to comment.
You can’t perform that action at this time.