govuk_navigation_helpers 8.2.2 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "8.2.2".freeze
2
+ VERSION = "9.0.0".freeze
3
3
  end
@@ -20,8 +20,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
20
20
  "external_related_links" => []
21
21
  },
22
22
  "links" => {
23
- }
24
- )
23
+ })
25
24
 
26
25
  expected = {
27
26
  related_items: [],
@@ -130,8 +129,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
130
129
  "locale" => "en"
131
130
  }
132
131
  ],
133
- }
134
- )
132
+ })
135
133
 
136
134
  expected = {
137
135
  related_items: [{ path: "/related-item", text: "related item" }],
@@ -171,8 +169,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
171
169
  "locale" => "en"
172
170
  }
173
171
  ],
174
- }
175
- )
172
+ })
176
173
  expected = {
177
174
  related_items: [],
178
175
  collections: [],
@@ -211,8 +208,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
211
208
  "locale" => "en"
212
209
  }
213
210
  ],
214
- }
215
- )
211
+ })
216
212
  expected = {
217
213
  related_items: [],
218
214
  collections: [],
@@ -237,8 +233,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
237
233
  "url" => "https://external"
238
234
  }
239
235
  ]
240
- },
241
- )
236
+ },)
242
237
 
243
238
  expected = [
244
239
  [
@@ -291,8 +286,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
291
286
  "document_type" => "topic",
292
287
  }
293
288
  ],
294
- }
295
- )
289
+ })
296
290
  expected = {
297
291
  related_items: [{ text: "Self Assessment tax returns", path: "/self-assessment-tax-returns" }],
298
292
  collections: [],
@@ -1,84 +1,84 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module GovukNavigationHelpers
4
- RSpec.describe TasklistContent do
4
+ RSpec.describe StepNavContent do
5
5
  let(:path) { '/pass-plus' }
6
- let(:tasklist_content) { described_class.new(file_name: "learn-to-drive-a-car", path: path) }
6
+ let(:step_nav_content) { described_class.new(file_name: "learn-to-drive-a-car", path: path) }
7
7
 
8
- context '.current_tasklist' do
8
+ context '.current_step_nav' do
9
9
  context 'based on the request' do
10
10
  context 'when the path is /pass-plus' do
11
- it 'returns "Learn to Drive" tasklist' do
12
- current_tasklist = described_class.current_tasklist(path)
11
+ it 'returns "Learn to Drive" step nav' do
12
+ current_step_nav = described_class.current_step_nav(path)
13
13
 
14
14
  expect(
15
- current_tasklist.title
15
+ current_step_nav.title
16
16
  ).to eql('Learn to drive a car: step by step')
17
17
  end
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
- context '#is_page_included_in_ab_test?' do
23
- context 'when the requested path is part of the current tasklist' do
22
+ context '#show_step_nav?' do
23
+ context 'when the requested path is part of the current step nav' do
24
24
  it 'returns true' do
25
25
  expect(
26
- tasklist_content.is_page_included_in_ab_test?
26
+ step_nav_content.show_step_nav?
27
27
  ).to be true
28
28
  end
29
29
  end
30
30
 
31
- context 'when the requested path is not part of the current tasklist' do
31
+ context 'when the requested path is not part of the current step nav' do
32
32
  let(:path) { '/pink-plus' }
33
33
 
34
34
  it 'returns false' do
35
35
  expect(
36
- tasklist_content.is_page_included_in_ab_test?
36
+ step_nav_content.show_step_nav?
37
37
  ).to be false
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
- context '#set_current_task' do
42
+ context '#set_current_step' do
43
43
  it 'sets /pass-plus as active' do
44
- tasklist_content.set_current_task
44
+ step_nav_content.set_current_step
45
45
 
46
46
  expect(
47
- tasklist_content.groups.last[0][:contents].last[:contents][0][:href]
47
+ step_nav_content.steps.last[:contents].last[:contents][0][:href]
48
48
  ).to eql('/pass-plus')
49
49
 
50
50
  expect(
51
- tasklist_content.tasklist[:show_step]
51
+ step_nav_content.step_nav[:show_step]
52
52
  ).to eql(7)
53
53
 
54
54
  expect(
55
- tasklist_content.groups.last[0][:contents].last[:contents][0][:active]
55
+ step_nav_content.steps.last[:contents].last[:contents][0][:active]
56
56
  ).to be true
57
57
  end
58
58
  end
59
59
 
60
- context "learning to drive a car tasklist content" do
60
+ context "learning to drive a car step nav content" do
61
61
  it "has symbolized keys" do
62
- tasklist_content.tasklist.keys.each do |key|
62
+ step_nav_content.step_nav.each_key do |key|
63
63
  expect(key.is_a?(Symbol)).to be true
64
64
  end
65
65
  end
66
66
 
67
67
  it "has a title" do
68
- expect(tasklist_content.title).to eql("Learn to drive a car: step by step")
68
+ expect(step_nav_content.title).to eql("Learn to drive a car: step by step")
69
69
  end
70
70
 
71
71
  it "has a base_path" do
72
- expect(tasklist_content.base_path).to eql("/learn-to-drive-a-car")
72
+ expect(step_nav_content.base_path).to eql("/learn-to-drive-a-car")
73
73
  end
74
74
 
75
75
  it "configures a sidebar" do
76
- expect(tasklist_content.tasklist[:heading_level]).to eql(3)
77
- expect(tasklist_content.tasklist[:small]).to be true
76
+ expect(step_nav_content.step_nav[:heading_level]).to eql(3)
77
+ expect(step_nav_content.step_nav[:small]).to be true
78
78
  end
79
79
 
80
80
  it "has a link in the correct structure" do
81
- first_link = tasklist_content.tasklist[:groups][0][0][:contents][1][:contents][0]
81
+ first_link = step_nav_content.step_nav[:steps][0][:contents][1][:contents][0]
82
82
  expect(first_link[:href]).to eql("/vehicles-can-drive")
83
83
  expect(first_link[:text]).to eql("Check what age you can drive")
84
84
  end
@@ -109,7 +109,7 @@ module GovukNavigationHelpers
109
109
  ).sort
110
110
 
111
111
  expect(
112
- tasklist_content.primary_paths.sort
112
+ step_nav_content.primary_paths.sort
113
113
  ).to match_array(primary_paths)
114
114
  end
115
115
 
@@ -155,7 +155,7 @@ module GovukNavigationHelpers
155
155
  ).sort
156
156
 
157
157
  expect(
158
- tasklist_content.related_paths.sort
158
+ step_nav_content.related_paths.sort
159
159
  ).to match_array(related_paths)
160
160
  end
161
161
  end
@@ -111,7 +111,7 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
111
111
 
112
112
  context 'with multiple parents' do
113
113
  it "selects the first parent taxon in alphabetical order by title" do
114
- parent_1 = {
114
+ parent1 = {
115
115
  "content_id" => "30c1b93d-2553-47c9-bc3c-fc5b513ecc32",
116
116
  "locale" => "en",
117
117
  "title" => "Parent A",
@@ -120,7 +120,7 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
120
120
  "parent_taxons" => []
121
121
  }
122
122
  }
123
- parent_2 = {
123
+ parent2 = {
124
124
  "content_id" => "30c1b93d-2553-47c9-bc3c-fc5b513ecc32",
125
125
  "locale" => "en",
126
126
  "title" => "Parent B",
@@ -130,7 +130,7 @@ RSpec.describe GovukNavigationHelpers::TaxonBreadcrumbs do
130
130
  }
131
131
  }
132
132
 
133
- content_item = taxon_with_parent_taxons([parent_2, parent_1])
133
+ content_item = taxon_with_parent_taxons([parent2, parent1])
134
134
  breadcrumbs = breadcrumbs_for(content_item)
135
135
 
136
136
  expect(breadcrumbs).to eq(
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_navigation_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.2
4
+ version: 9.0.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: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gds-api-adapters
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '43.0'
19
+ version: '5.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '43.0'
26
+ version: '5.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: govuk_ab_testing
28
+ name: gds-api-adapters
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.4'
33
+ version: '43.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.4'
40
+ version: '43.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: activesupport
42
+ name: govuk_ab_testing
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.1'
47
+ version: '2.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.1'
54
+ version: '2.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,117 +67,117 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: gem_publisher
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: 1.5.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: 1.5.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: govuk-lint
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.5'
89
+ version: 3.6.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.5'
96
+ version: 3.6.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: gem_publisher
98
+ name: govuk_schemas
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.5.0
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.5.0
110
+ version: '1.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: govuk-lint
112
+ name: pry-byebug
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2.1
117
+ version: '3.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.2.1
124
+ version: '3.4'
125
125
  - !ruby/object:Gem::Dependency
126
- name: pry-byebug
126
+ name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3.4'
131
+ version: '10.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.4'
138
+ version: '10.0'
139
139
  - !ruby/object:Gem::Dependency
140
- name: yard
140
+ name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.9.12
145
+ version: '3.5'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.9.12
152
+ version: '3.5'
153
153
  - !ruby/object:Gem::Dependency
154
- name: govuk_schemas
154
+ name: webmock
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.0'
159
+ version: '2.3'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.0'
166
+ version: '2.3'
167
167
  - !ruby/object:Gem::Dependency
168
- name: webmock
168
+ name: yard
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '2.3'
173
+ version: 0.9.12
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '2.3'
180
+ version: 0.9.12
181
181
  description: Gem to transform items from the content-store into payloads for GOV.UK
182
182
  components
183
183
  email:
@@ -196,30 +196,28 @@ files:
196
196
  - LICENCE.txt
197
197
  - README.md
198
198
  - Rakefile
199
- - config/tasklists/learn-to-drive-a-car.json
199
+ - config/step_navs/learn-to-drive-a-car.json
200
200
  - govuk_navigation_helpers.gemspec
201
201
  - lib/govuk_navigation_helpers.rb
202
202
  - lib/govuk_navigation_helpers/breadcrumbs.rb
203
203
  - lib/govuk_navigation_helpers/configuration.rb
204
204
  - lib/govuk_navigation_helpers/content_item.rb
205
205
  - lib/govuk_navigation_helpers/curated_taxonomy_sidebar_links.rb
206
- - lib/govuk_navigation_helpers/current_tasklist_ab_test.rb
207
206
  - lib/govuk_navigation_helpers/grouped_related_links.rb
208
207
  - lib/govuk_navigation_helpers/related_items.rb
209
208
  - lib/govuk_navigation_helpers/related_navigation_sidebar.rb
210
209
  - lib/govuk_navigation_helpers/rummager_taxonomy_sidebar_links.rb
211
210
  - lib/govuk_navigation_helpers/services.rb
212
- - lib/govuk_navigation_helpers/tasklist_content.rb
211
+ - lib/govuk_navigation_helpers/step_nav_content.rb
213
212
  - lib/govuk_navigation_helpers/taxon_breadcrumbs.rb
214
213
  - lib/govuk_navigation_helpers/taxonomy_sidebar.rb
215
214
  - lib/govuk_navigation_helpers/version.rb
216
215
  - spec/breadcrumbs_spec.rb
217
216
  - spec/content_item_spec.rb
218
- - spec/current_tasklist_ab_test_spec.rb
219
217
  - spec/related_items_spec.rb
220
218
  - spec/related_navigation_sidebar_spec.rb
221
219
  - spec/spec_helper.rb
222
- - spec/tasklist_content_spec.rb
220
+ - spec/step_nav_content_spec.rb
223
221
  - spec/taxon_breadcrumbs_spec.rb
224
222
  - spec/taxonomy_sidebar_spec.rb
225
223
  homepage: https://github.com/alphagov/govuk_navigation_helpers
@@ -249,10 +247,9 @@ summary: Gem to transform items from the content-store into payloads for GOV.UK
249
247
  test_files:
250
248
  - spec/breadcrumbs_spec.rb
251
249
  - spec/content_item_spec.rb
252
- - spec/current_tasklist_ab_test_spec.rb
253
250
  - spec/related_items_spec.rb
254
251
  - spec/related_navigation_sidebar_spec.rb
255
252
  - spec/spec_helper.rb
256
- - spec/tasklist_content_spec.rb
253
+ - spec/step_nav_content_spec.rb
257
254
  - spec/taxon_breadcrumbs_spec.rb
258
255
  - spec/taxonomy_sidebar_spec.rb