paginate-responder 2.0.0 → 2.1.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/paginate-responder/version.rb +1 -1
- data/lib/responders/paginate_responder.rb +1 -1
- data/spec/paginate_responder_spec.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3ebda3ad93e015f751f7232187fd433ee5b54cc9e9510e12968b5ade630d1e8
|
4
|
+
data.tar.gz: 21f34ffb96d3e184f58397f22386cddb95cef44a1a8f44e90fc8e542955652d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eb260f7dabd7a7a7511a4dfe2f03e6f2017cd77a56ac9f10d2ab785c423e1bbef6d5d08f507bb64d227e6aa7303724c4671dd54c4ddc8f42bc09f4961fe767a
|
7
|
+
data.tar.gz: 0f868e1b1e0ad53cb38cd9394ee40391dc25f7d1ba9efbcfbd520fa1829bb78b626f7b31b15490962998127e5e9c43109d25a6fa7f2c3c1e9847892570376168
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 2.1.0 - 2019-02-28
|
10
|
+
### Added
|
11
|
+
* Respond with pagination link headers to HEAD requests (#12)
|
12
|
+
|
9
13
|
## 2.0.0 - 2019-02-19
|
10
14
|
### Changed
|
11
15
|
* Override respond, not to_format for compatibility with decorate-responder 2.0 (#17)
|
@@ -21,14 +21,15 @@ RSpec.describe Responders::PaginateResponder, type: :controller do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
let(:method) { :get }
|
24
25
|
let(:response) { action.call; @response }
|
25
26
|
let(:json) { JSON.parse response.body }
|
26
27
|
let(:params) { {format: :json} }
|
27
28
|
|
28
29
|
if ActionPack::VERSION::MAJOR >= 5
|
29
|
-
let(:action) { -> {
|
30
|
+
let(:action) { -> { send(method, :index, params: params) } }
|
30
31
|
else
|
31
|
-
let(:action) { -> {
|
32
|
+
let(:action) { -> { send(method, :index, params) } }
|
32
33
|
end
|
33
34
|
|
34
35
|
context 'with AR resource' do
|
@@ -163,6 +164,15 @@ RSpec.describe Responders::PaginateResponder, type: :controller do
|
|
163
164
|
it { is_expected.to include 'next' => 'http://test.host/index.json?page=2&per_page=50' }
|
164
165
|
it { is_expected.to include 'last' => 'http://test.host/index.json?page=14&per_page=50' }
|
165
166
|
end
|
167
|
+
|
168
|
+
context 'when method is HEAD' do
|
169
|
+
let(:method) { :head }
|
170
|
+
|
171
|
+
it { expect(subject.size).to eq 3 }
|
172
|
+
it { is_expected.to include 'first' => 'http://test.host/index.json?page=1' }
|
173
|
+
it { is_expected.to include 'next' => 'http://test.host/index.json?page=2' }
|
174
|
+
it { is_expected.to include 'last' => 'http://test.host/index.json?page=14' }
|
175
|
+
end
|
166
176
|
end
|
167
177
|
|
168
178
|
describe 'headers' do
|
@@ -172,5 +182,14 @@ RSpec.describe Responders::PaginateResponder, type: :controller do
|
|
172
182
|
it { is_expected.to include 'X-Total-Count' => '676' }
|
173
183
|
it { is_expected.to include 'X-Per-Page' => '50' }
|
174
184
|
it { is_expected.to include 'X-Current-Page' => '1' }
|
185
|
+
|
186
|
+
context 'when method is HEAD' do
|
187
|
+
let(:method) { :head }
|
188
|
+
|
189
|
+
it { is_expected.to include 'X-Total-Pages' => '14' }
|
190
|
+
it { is_expected.to include 'X-Total-Count' => '676' }
|
191
|
+
it { is_expected.to include 'X-Per-Page' => '50' }
|
192
|
+
it { is_expected.to include 'X-Current-Page' => '1' }
|
193
|
+
end
|
175
194
|
end
|
176
195
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paginate-responder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-link_headers
|