govuk_navigation_helpers 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a90b969d4918f507faf0a1786349dec54afb1860
4
- data.tar.gz: a5c670c1434dbe9a9469c980bd9bee9b9199e6c1
3
+ metadata.gz: c3d18101e3d40e2584d480f3aa5690142e1114c2
4
+ data.tar.gz: bb33a4f50beebe2d1b20fcd0546032f2360da0fe
5
5
  SHA512:
6
- metadata.gz: d07df36796dbe825414fcae535d69dad0778fdbd58868a1e653d6de2d3322aea102687b2bf78c4fa20bcbcfef9eb54043907e0bccbb3f8273375db82406b2627
7
- data.tar.gz: 02e75793f4ee2884e62de9c819439d50ee286047ea058f5cc7dc10c251b7b3b405b037314f142188cc5c54ccc069a7a9c668d10e7454b093e790601cb0a8bca7
6
+ metadata.gz: f6b9748dec2db2e5206ee6d99a43da48ec8e0defdca905d792bc6e2e38170b2009468ca92603552f8093a0edb1c305ee0f7745ad05effcb6ccf822cdfc68fc5e
7
+ data.tar.gz: 92fe160a5c1860e2299b9760c1eb35cf248292fd449384ab345429f3b0edb65864604cbcb55ecc9bf0e54779674e3940af8e9f535a04e8b7836cc634f5c81a7b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 6.2.0
2
+
3
+ * Remove "Register to vote" section from related links data as deadline of
4
+ May 23rd 2017 has passed.
5
+
1
6
  ## 6.1.0
2
7
 
3
8
  * Add "Register to vote" section to related links data. This will only affect
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "gds-api-adapters", ">= 43.0"
22
- spec.add_runtime_dependency "activesupport"
23
22
 
24
23
  spec.add_development_dependency "bundler", "~> 1.6"
25
24
  spec.add_development_dependency "rake", "~> 10.0"
@@ -65,9 +65,5 @@ module GovukNavigationHelpers
65
65
  def external_links
66
66
  content_store_response.dig("details", "external_related_links").to_a
67
67
  end
68
-
69
- def document_type
70
- content_store_response.fetch('document_type')
71
- end
72
68
  end
73
69
  end
@@ -1,6 +1,3 @@
1
- require 'time'
2
- require 'active_support/core_ext/string/zones'
3
- require 'active_support/values/time_zone'
4
1
  require 'govuk_navigation_helpers/grouped_related_links'
5
2
  require 'govuk_navigation_helpers/content_item'
6
3
 
@@ -23,7 +20,6 @@ module GovukNavigationHelpers
23
20
  def related_items
24
21
  {
25
22
  sections: [
26
- register_to_vote_section,
27
23
  tagged_to_same_mainstream_browse_page_section,
28
24
  parents_tagged_to_same_mainstream_browse_page_section,
29
25
  tagged_to_different_mainstream_browse_pages_section,
@@ -36,30 +32,6 @@ module GovukNavigationHelpers
36
32
 
37
33
  attr_reader :content_item
38
34
 
39
- def register_to_vote_section
40
- return unless should_show_register_to_vote_section?
41
-
42
- {
43
- title: 'Register to vote',
44
- description: 'To vote in the General Election on 8 June, you need to apply to register by 11:59pm on 22 May.',
45
- url: nil,
46
- items: [
47
- title: 'Register to vote',
48
- url: '/register-to-vote'
49
- ]
50
- }
51
- end
52
-
53
- def should_show_register_to_vote_section?
54
- content_item.document_type == 'completed_transaction' &&
55
- register_to_vote_on_time? &&
56
- content_item.base_path !~ /register-to-vote/
57
- end
58
-
59
- def register_to_vote_on_time?
60
- Time.now < ActiveSupport::TimeZone['London'].parse('2017-05-22T23:59:59')
61
- end
62
-
63
35
  def tagged_to_same_mainstream_browse_page_section
64
36
  return unless grouped.tagged_to_same_mainstream_browse_page.any?
65
37
 
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "6.1.0".freeze
2
+ VERSION = "6.2.0".freeze
3
3
  end
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe GovukNavigationHelpers::RelatedItems do
4
- def payload_for(content_item, schema = "placeholder")
5
- generator = GovukSchemas::RandomExample.for_schema(schema, schema_type: "frontend")
4
+ def payload_for(content_item)
5
+ generator = GovukSchemas::RandomExample.for_schema("placeholder", schema_type: "frontend")
6
6
  fully_valid_content_item = generator.merge_and_validate(content_item)
7
7
  GovukNavigationHelpers::NavigationHelper.new(fully_valid_content_item).related_items
8
8
  end
@@ -263,72 +263,5 @@ RSpec.describe GovukNavigationHelpers::RelatedItems do
263
263
  ]
264
264
  )
265
265
  end
266
-
267
- it 'does not generate the register to vote section for /register-to-vote' do
268
- allow(Time).to receive(:now).and_return(Time.parse('2017-05-05'))
269
- content_item = {
270
- "base_path" => "/register-to-vote",
271
- "document_type" => "completed_transaction",
272
- "links" => {},
273
- "details" => {
274
- "external_related_links" => [],
275
- "promotion" => {
276
- "category" => "organ_donor",
277
- "url" => "https://www.organdonation.nhs.uk/"
278
- }
279
- }
280
- }
281
- transaction_payload = payload_for(content_item, "completed_transaction")
282
-
283
- expect(transaction_payload).to eql(sections: [])
284
- end
285
-
286
- it 'generates the register to vote section for completed transactions with register to vote promotion' do
287
- allow(Time).to receive(:now).and_return(Time.parse('2017-05-05'))
288
- content_item = {
289
- "base_path" => "/done/pay-dvla-fine",
290
- "document_type" => "completed_transaction",
291
- "links" => {},
292
- "details" => {
293
- "external_related_links" => [],
294
- "promotion" => {
295
- "category" => "register_to_vote",
296
- "url" => "/register-to-vote"
297
- }
298
- }
299
- }
300
- transaction_payload = payload_for(content_item, "completed_transaction")
301
-
302
- expect(transaction_payload).to eql(
303
- sections: [{
304
- title: "Register to vote",
305
- description: "To vote in the General Election on 8 June, you need to apply to register by 11:59pm on 22 May.",
306
- url: nil,
307
- items: [
308
- title: "Register to vote",
309
- url: "/register-to-vote"
310
- ]
311
- }]
312
- )
313
- end
314
-
315
- it 'does not show the register to vote section after May 23rd' do
316
- allow(Time).to receive(:now).and_return(Time.parse('2017-05-24'))
317
- content_item = {
318
- "base_path" => "/done/pay-dvla-fine",
319
- "document_type" => "completed_transaction",
320
- "links" => {},
321
- "details" => {
322
- "external_related_links" => [],
323
- "promotion" => {
324
- "category" => "register_to_vote",
325
- "url" => "/register-to-vote"
326
- }
327
- }
328
- }
329
- transaction_payload = payload_for(content_item, "completed_transaction")
330
-
331
- expect(transaction_payload).to eql(sections: [])
332
- end
333
266
  end
334
267
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_navigation_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '43.0'
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement