grape-kaminari 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39954bcb02e83af2783635756ce5d94942edbbd0550c3670e467ba39eb9f2b00
4
- data.tar.gz: 6c15582e16ae68fa09d7e1fd9480188d96bd7be0cd4c48cdc376cdddc03ed06d
3
+ metadata.gz: d0ae809ad4c135dcf91437d3e66be5aeade55263df274f958da45e3518643121
4
+ data.tar.gz: 6444fd46138c8e330a9c74254f27d0512ea861df07eb90cde07f070a1e43a0e6
5
5
  SHA512:
6
- metadata.gz: 107535d26da91163d588390787b298b41e886466c6904eb59edbea9cae52643f43c5f4d418976a347b6704cbfdd67f8b0013532c6dfacc98c3db4900058b37fe
7
- data.tar.gz: dc4b45493fe12f1dfd454437d12714850d97445062296162ab177780ef1c5bf0bbd9bb1b3330fe87fb7a0318ac400d6c1491c9851fabf46f1532c6bb8c17a3e5
6
+ metadata.gz: 5633fb0d0acecfe2aa68eaff97e29aabddd087922b0ab17a439b26a6fd8ac3889f5f3c902dff54b1729bace30fe6c81c2972a1075785653ea0785b5326ad79e0
7
+ data.tar.gz: 25fbc7a3ad61bc457e237da7ccf9dfbced16c76b291cec006ed45ac9504fc9e208d3f5ac2e3f30f9f94396d7b157214f106aeec05bd8d121e1b6ee06e614025a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape-kaminari (0.2.0)
4
+ grape-kaminari (0.2.1)
5
5
  grape (>= 1.0)
6
6
  kaminari-grape
7
7
 
@@ -3,7 +3,7 @@ module Grape
3
3
  class MaxValueValidator < Grape::Validations::Base
4
4
  def validate_param!(attr_name, params)
5
5
  attr = params[attr_name]
6
- return unless attr && @option && attr > @option
6
+ return unless attr.is_a?(Integer) && @option && attr > @option
7
7
 
8
8
  raise Grape::Exceptions::Validation.new(
9
9
  params: [@scope.full_name(attr_name)],
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Kaminari
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
@@ -99,15 +99,21 @@ describe Grape::Kaminari do
99
99
 
100
100
  it 'succeeds when :per_page is within :max_value' do
101
101
  get('/', page: 1, per_page: 999)
102
- expect(last_response.status).to eq 200
102
+ expect(last_response.status).to eq(200)
103
103
  end
104
104
 
105
105
  it 'ensures :per_page is within :max_value' do
106
106
  get('/', page: 1, per_page: 1_000)
107
- expect(last_response.status).to eq 400
107
+ expect(last_response.status).to eq(400)
108
108
  expect(last_response.body).to match(/per_page must be less than or equal 999/)
109
109
  end
110
110
 
111
+ it 'ensures :per_page is numeric' do
112
+ get('/', page: 1, per_page: 'foo')
113
+ expect(last_response.status).to eq(400)
114
+ expect(last_response.body).to match(/per_page is invalid/)
115
+ end
116
+
111
117
  it 'defaults :offset to customized value' do
112
118
  expect(params['offset'][:default]).to eq(9)
113
119
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-kaminari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski