govuk_content_item_loader 1.2.0 → 1.2.2
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/.github/workflows/ci.yml +1 -1
- data/CHANGELOG.md +8 -0
- data/govuk_content_item_loader.gemspec +1 -0
- data/lib/govuk_content_item_loader/test_helpers.rb +14 -14
- data/lib/govuk_content_item_loader/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 704a8afd75af58674109ebefcb22e9855c481d7b5280330e6f1d25eac2fcbec2
|
|
4
|
+
data.tar.gz: 7415244c1e4abd90dfd25e1499bb083839e1dc0bc37d6ae6c9937c9c256a9c26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20823b0e5c2a93ede2bb195995393aa692dbb07e4b5d0cafe02b6d241ecac06c072bb8f009419dd66424b44a91237e813d6e226a282c300a46eb12fc7c52a13a
|
|
7
|
+
data.tar.gz: b9a349fb86b3232ae009d77c60672c0c8cdea9c5850f2d639e17ca09ea3d6724999314cfdbc540d933353aa4d333abc18716eb17607b1272b2f1a73a29430037
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
39
39
|
with:
|
|
40
40
|
ref: ${{ inputs.ref || github.ref }}
|
|
41
|
-
- uses: ruby/setup-ruby@
|
|
41
|
+
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
|
|
42
42
|
with:
|
|
43
43
|
ruby-version: ${{ matrix.ruby }}
|
|
44
44
|
bundler-cache: true
|
data/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.require_paths = %w[lib]
|
|
21
21
|
|
|
22
22
|
spec.add_dependency "gds-api-adapters", ">= 99.3"
|
|
23
|
+
spec.add_dependency "plek", ">= 1.9.0"
|
|
23
24
|
spec.add_dependency "railties", ">= 7.2"
|
|
24
25
|
|
|
25
26
|
spec.add_development_dependency "climate_control"
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
module GovukConditionalContentItemLoaderTestHelpers
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
JSON.parse(body)
|
|
7
|
-
end
|
|
8
|
-
end
|
|
4
|
+
CONTENT_STORE_ENDPOINT = Plek.find("content-store")
|
|
5
|
+
PUBLISHING_API_ENDPOINT = Plek.find("publishing-api")
|
|
9
6
|
|
|
10
7
|
# Stubs the loader returns a content item
|
|
11
8
|
# The following options can be passed in:
|
|
@@ -14,22 +11,25 @@ module GovukConditionalContentItemLoaderTestHelpers
|
|
|
14
11
|
# :private if true, the Cache-Control header will include the "private" directive. By default it
|
|
15
12
|
# will include "public"
|
|
16
13
|
def stub_conditional_loader_returns_content_item(body, options = {})
|
|
17
|
-
body
|
|
14
|
+
body = body.is_a?(String) ? body : body.to_json
|
|
18
15
|
max_age = options.fetch(:max_age, 900)
|
|
19
16
|
visibility = options[:private] ? "private" : "public"
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
[CONTENT_STORE_ENDPOINT, PUBLISHING_API_ENDPOINT].each do |endpoint|
|
|
19
|
+
stub_request(:get, %r{#{Regexp.escape(endpoint)}}).to_return(
|
|
20
|
+
status: 200,
|
|
21
|
+
body: body,
|
|
22
|
+
headers: {
|
|
23
|
+
"Cache-Control" => "#{visibility}, max-age=#{max_age}",
|
|
24
|
+
"Date" => Time.now.httpdate,
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
end
|
|
25
28
|
|
|
26
|
-
loader = instance_double(GovukConditionalContentItemLoader, load:
|
|
29
|
+
loader = instance_double(GovukConditionalContentItemLoader, load: JSON.parse(body))
|
|
27
30
|
|
|
28
31
|
allow(GovukConditionalContentItemLoader).to receive(:new).with(request: anything)
|
|
29
32
|
.and_return(loader)
|
|
30
|
-
allow(loader).to receive(:load).and_return(body)
|
|
31
|
-
|
|
32
|
-
response
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# Stubs the loader returns a error response
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_content_item_loader
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '99.3'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: plek
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.9.0
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 1.9.0
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: railties
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -182,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
182
196
|
- !ruby/object:Gem::Version
|
|
183
197
|
version: '0'
|
|
184
198
|
requirements: []
|
|
185
|
-
rubygems_version: 4.0.
|
|
199
|
+
rubygems_version: 4.0.9
|
|
186
200
|
specification_version: 4
|
|
187
201
|
summary: Provides a standardised content item loader for GOV.UK frontend apps with
|
|
188
202
|
configurable GraphQL traffic routing and automatic fallback to the Content Store
|