ccs-frontend_helpers 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 0ef86c828ca8a268f9af33212c8ada74ff7ba0d0b01af5fc36200ec5ad98fde1
4
- data.tar.gz: 2259677fea66d59061a029ee951b4f2246a2e96adbd9d153f188054d34d213ad
3
+ metadata.gz: 1786ee02c965fd81738607681aab036498751bda16a9d4fba12862d8690dce63
4
+ data.tar.gz: 16db55bafa1e30038a04007529b55c11e013c606a7578a383e6cefa25be47815
5
5
  SHA512:
6
- metadata.gz: a451c37ef27586b33004da34c9a2d709e5cc97c8af0b477a509f16175788b0de2b2368ea13c4b3a88e2221a6fc9ebf3a6c42157bb10c5acfef662d45de473db9
7
- data.tar.gz: c8bf663b057106329a327c7a7d1f0219edc982f801fd34b46904de3223f3aa2c337c024569139b6dd3bf79afa62ec407a571ab9b93e010c86eb70d795207c608
6
+ metadata.gz: d2ec119f59395f3d2d12a09442e9aee00098aa7cc9a2cf601564002feb5752d4b7399e6c4f091404c89b3f2e93d4ac889f35fd883fdf38142ee4ef939f1565c3
7
+ data.tar.gz: 225e9d0089b818103b01709d4dbd9a68185e1da445a60d936f99c30f6c5bb7ab6c22821f51c84a447ae372d50f9b11f1430a64f9054b54e31c7fd30268129e9f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.1.2] - 2023-11-16
2
+
3
+ Fix issue with radios component which, when passed a model or form, would treat the value as an array.
4
+ This did not cause an issue for strings as the `include?` method still works for them but if the value was a boolean or a number then an error would be thrown.
5
+
1
6
  ## [0.1.1] - 2023-10-25
2
7
 
3
8
  Fix some bugs with various helpers and update dependencies
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  # Gems for building the package
9
9
  gem 'bundler', '~> 2.3'
10
- gem 'rake', '~> 13.0'
10
+ gem 'rake', '~> 13.1'
11
11
 
12
12
  # Gems for testing the package
13
13
  gem 'capybara', '~> 3.39.2'
@@ -16,9 +16,9 @@ gem 'simplecov', '~> 0.21'
16
16
 
17
17
  # Gems for linting/formatting the package
18
18
  gem 'rubocop', '~> 1.57'
19
- gem 'rubocop-rails', '~> 2.21'
19
+ gem 'rubocop-rails', '~> 2.22'
20
20
  gem 'rubocop-rake', '~> 0.6'
21
- gem 'rubocop-rspec', '~> 2.24'
21
+ gem 'rubocop-rspec', '~> 2.25'
22
22
 
23
23
  # Gems for documenting the package
24
24
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,76 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.1)
4
+ ccs-frontend_helpers (0.1.2)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.1)
11
- actionpack (= 7.1.1)
12
- activesupport (= 7.1.1)
10
+ actioncable (7.1.2)
11
+ actionpack (= 7.1.2)
12
+ activesupport (= 7.1.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.1)
17
- actionpack (= 7.1.1)
18
- activejob (= 7.1.1)
19
- activerecord (= 7.1.1)
20
- activestorage (= 7.1.1)
21
- activesupport (= 7.1.1)
16
+ actionmailbox (7.1.2)
17
+ actionpack (= 7.1.2)
18
+ activejob (= 7.1.2)
19
+ activerecord (= 7.1.2)
20
+ activestorage (= 7.1.2)
21
+ activesupport (= 7.1.2)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.1.1)
27
- actionpack (= 7.1.1)
28
- actionview (= 7.1.1)
29
- activejob (= 7.1.1)
30
- activesupport (= 7.1.1)
26
+ actionmailer (7.1.2)
27
+ actionpack (= 7.1.2)
28
+ actionview (= 7.1.2)
29
+ activejob (= 7.1.2)
30
+ activesupport (= 7.1.2)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.1)
37
- actionview (= 7.1.1)
38
- activesupport (= 7.1.1)
36
+ actionpack (7.1.2)
37
+ actionview (= 7.1.2)
38
+ activesupport (= 7.1.2)
39
39
  nokogiri (>= 1.8.5)
40
+ racc
40
41
  rack (>= 2.2.4)
41
42
  rack-session (>= 1.0.1)
42
43
  rack-test (>= 0.6.3)
43
44
  rails-dom-testing (~> 2.2)
44
45
  rails-html-sanitizer (~> 1.6)
45
- actiontext (7.1.1)
46
- actionpack (= 7.1.1)
47
- activerecord (= 7.1.1)
48
- activestorage (= 7.1.1)
49
- activesupport (= 7.1.1)
46
+ actiontext (7.1.2)
47
+ actionpack (= 7.1.2)
48
+ activerecord (= 7.1.2)
49
+ activestorage (= 7.1.2)
50
+ activesupport (= 7.1.2)
50
51
  globalid (>= 0.6.0)
51
52
  nokogiri (>= 1.8.5)
52
- actionview (7.1.1)
53
- activesupport (= 7.1.1)
53
+ actionview (7.1.2)
54
+ activesupport (= 7.1.2)
54
55
  builder (~> 3.1)
55
56
  erubi (~> 1.11)
56
57
  rails-dom-testing (~> 2.2)
57
58
  rails-html-sanitizer (~> 1.6)
58
- activejob (7.1.1)
59
- activesupport (= 7.1.1)
59
+ activejob (7.1.2)
60
+ activesupport (= 7.1.2)
60
61
  globalid (>= 0.3.6)
61
- activemodel (7.1.1)
62
- activesupport (= 7.1.1)
63
- activerecord (7.1.1)
64
- activemodel (= 7.1.1)
65
- activesupport (= 7.1.1)
62
+ activemodel (7.1.2)
63
+ activesupport (= 7.1.2)
64
+ activerecord (7.1.2)
65
+ activemodel (= 7.1.2)
66
+ activesupport (= 7.1.2)
66
67
  timeout (>= 0.4.0)
67
- activestorage (7.1.1)
68
- actionpack (= 7.1.1)
69
- activejob (= 7.1.1)
70
- activerecord (= 7.1.1)
71
- activesupport (= 7.1.1)
68
+ activestorage (7.1.2)
69
+ actionpack (= 7.1.2)
70
+ activejob (= 7.1.2)
71
+ activerecord (= 7.1.2)
72
+ activesupport (= 7.1.2)
72
73
  marcel (~> 1.0)
73
- activesupport (7.1.1)
74
+ activesupport (7.1.2)
74
75
  base64
75
76
  bigdecimal
76
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -83,7 +84,7 @@ GEM
83
84
  addressable (2.8.4)
84
85
  public_suffix (>= 2.0.2, < 6.0)
85
86
  ast (2.4.2)
86
- base64 (0.1.1)
87
+ base64 (0.2.0)
87
88
  bigdecimal (3.1.4)
88
89
  builder (3.2.4)
89
90
  capybara (3.39.2)
@@ -98,10 +99,10 @@ GEM
98
99
  concurrent-ruby (1.2.2)
99
100
  connection_pool (2.4.1)
100
101
  crass (1.0.6)
101
- date (3.3.3)
102
+ date (3.3.4)
102
103
  diff-lcs (1.5.0)
103
104
  docile (1.4.0)
104
- drb (2.1.1)
105
+ drb (2.2.0)
105
106
  ruby2_keywords
106
107
  erubi (1.12.0)
107
108
  globalid (1.2.1)
@@ -109,7 +110,7 @@ GEM
109
110
  i18n (1.14.1)
110
111
  concurrent-ruby (~> 1.0)
111
112
  io-console (0.6.0)
112
- irb (1.8.3)
113
+ irb (1.9.0)
113
114
  rdoc
114
115
  reline (>= 0.3.8)
115
116
  json (2.6.3)
@@ -126,13 +127,13 @@ GEM
126
127
  matrix (0.4.2)
127
128
  mini_mime (1.1.5)
128
129
  minitest (5.20.0)
129
- mutex_m (0.1.2)
130
- net-imap (0.4.2)
130
+ mutex_m (0.2.0)
131
+ net-imap (0.4.4)
131
132
  date
132
133
  net-protocol
133
134
  net-pop (0.1.2)
134
135
  net-protocol
135
- net-protocol (0.2.1)
136
+ net-protocol (0.2.2)
136
137
  timeout
137
138
  net-smtp (0.4.0)
138
139
  net-protocol
@@ -148,7 +149,7 @@ GEM
148
149
  psych (5.1.1.1)
149
150
  stringio
150
151
  public_suffix (5.0.1)
151
- racc (1.7.1)
152
+ racc (1.7.3)
152
153
  rack (3.0.8)
153
154
  rack-session (2.0.0)
154
155
  rack (>= 3.0.0)
@@ -157,20 +158,20 @@ GEM
157
158
  rackup (2.1.0)
158
159
  rack (>= 3)
159
160
  webrick (~> 1.8)
160
- rails (7.1.1)
161
- actioncable (= 7.1.1)
162
- actionmailbox (= 7.1.1)
163
- actionmailer (= 7.1.1)
164
- actionpack (= 7.1.1)
165
- actiontext (= 7.1.1)
166
- actionview (= 7.1.1)
167
- activejob (= 7.1.1)
168
- activemodel (= 7.1.1)
169
- activerecord (= 7.1.1)
170
- activestorage (= 7.1.1)
171
- activesupport (= 7.1.1)
161
+ rails (7.1.2)
162
+ actioncable (= 7.1.2)
163
+ actionmailbox (= 7.1.2)
164
+ actionmailer (= 7.1.2)
165
+ actionpack (= 7.1.2)
166
+ actiontext (= 7.1.2)
167
+ actionview (= 7.1.2)
168
+ activejob (= 7.1.2)
169
+ activemodel (= 7.1.2)
170
+ activerecord (= 7.1.2)
171
+ activestorage (= 7.1.2)
172
+ activesupport (= 7.1.2)
172
173
  bundler (>= 1.15.0)
173
- railties (= 7.1.1)
174
+ railties (= 7.1.2)
174
175
  rails-dom-testing (2.2.0)
175
176
  activesupport (>= 5.0.0)
176
177
  minitest
@@ -178,20 +179,20 @@ GEM
178
179
  rails-html-sanitizer (1.6.0)
179
180
  loofah (~> 2.21)
180
181
  nokogiri (~> 1.14)
181
- railties (7.1.1)
182
- actionpack (= 7.1.1)
183
- activesupport (= 7.1.1)
182
+ railties (7.1.2)
183
+ actionpack (= 7.1.2)
184
+ activesupport (= 7.1.2)
184
185
  irb
185
186
  rackup (>= 1.0.0)
186
187
  rake (>= 12.2)
187
188
  thor (~> 1.0, >= 1.2.2)
188
189
  zeitwerk (~> 2.6)
189
190
  rainbow (3.1.1)
190
- rake (13.0.6)
191
- rdoc (6.5.0)
191
+ rake (13.1.0)
192
+ rdoc (6.6.0)
192
193
  psych (>= 4.0.0)
193
194
  regexp_parser (2.8.2)
194
- reline (0.3.9)
195
+ reline (0.4.0)
195
196
  io-console (~> 0.5)
196
197
  rexml (3.2.6)
197
198
  rspec (3.12.0)
@@ -207,8 +208,7 @@ GEM
207
208
  diff-lcs (>= 1.2.0, < 2.0)
208
209
  rspec-support (~> 3.12.0)
209
210
  rspec-support (3.12.0)
210
- rubocop (1.57.1)
211
- base64 (~> 0.1.1)
211
+ rubocop (1.57.2)
212
212
  json (~> 2.3)
213
213
  language_server-protocol (>= 3.17.0)
214
214
  parallel (~> 1.10)
@@ -219,20 +219,20 @@ GEM
219
219
  rubocop-ast (>= 1.28.1, < 2.0)
220
220
  ruby-progressbar (~> 1.7)
221
221
  unicode-display_width (>= 2.4.0, < 3.0)
222
- rubocop-ast (1.29.0)
222
+ rubocop-ast (1.30.0)
223
223
  parser (>= 3.2.1.0)
224
224
  rubocop-capybara (2.19.0)
225
225
  rubocop (~> 1.41)
226
226
  rubocop-factory_bot (2.24.0)
227
227
  rubocop (~> 1.33)
228
- rubocop-rails (2.21.2)
228
+ rubocop-rails (2.22.1)
229
229
  activesupport (>= 4.2.0)
230
230
  rack (>= 1.1)
231
231
  rubocop (>= 1.33.0, < 2.0)
232
232
  rubocop-rake (0.6.0)
233
233
  rubocop (~> 1.0)
234
- rubocop-rspec (2.24.1)
235
- rubocop (~> 1.33)
234
+ rubocop-rspec (2.25.0)
235
+ rubocop (~> 1.40)
236
236
  rubocop-capybara (~> 2.17)
237
237
  rubocop-factory_bot (~> 2.22)
238
238
  ruby-progressbar (1.13.0)
@@ -243,9 +243,9 @@ GEM
243
243
  simplecov_json_formatter (~> 0.1)
244
244
  simplecov-html (0.12.3)
245
245
  simplecov_json_formatter (0.1.4)
246
- stringio (3.0.8)
246
+ stringio (3.0.9)
247
247
  thor (1.3.0)
248
- timeout (0.4.0)
248
+ timeout (0.4.1)
249
249
  tzinfo (2.0.6)
250
250
  concurrent-ruby (~> 1.0)
251
251
  unicode-display_width (2.5.0)
@@ -267,12 +267,12 @@ DEPENDENCIES
267
267
  bundler (~> 2.3)
268
268
  capybara (~> 3.39.2)
269
269
  ccs-frontend_helpers!
270
- rake (~> 13.0)
270
+ rake (~> 13.1)
271
271
  rspec (~> 3.12)
272
272
  rubocop (~> 1.57)
273
- rubocop-rails (~> 2.21)
273
+ rubocop-rails (~> 2.22)
274
274
  rubocop-rake (~> 0.6)
275
- rubocop-rspec (~> 2.24)
275
+ rubocop-rspec (~> 2.25)
276
276
  simplecov (~> 0.21)
277
277
  yard (~> 0.9)
278
278
 
@@ -23,7 +23,7 @@ module CCS
23
23
 
24
24
  public
25
25
 
26
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
26
+ # rubocop:disable Metrics/CyclomaticComplexity
27
27
 
28
28
  # @param (see CCS::Components::GovUK::Field::Inputs#initialize)
29
29
  # @param radio_items [Array<Hash>] an array of options for the radios.
@@ -35,8 +35,8 @@ module CCS
35
35
  super(attribute: attribute, **options)
36
36
 
37
37
  if @options[:model] || @options[:form]
38
- values = (@options[:model] || @options[:form].object).send(attribute) || []
39
- radio_items.each { |radio_item| radio_item[:checked] = values.include?(radio_item[:value]) }
38
+ value = (@options[:model] || @options[:form].object).send(attribute)
39
+ radio_items.each { |radio_item| radio_item[:checked] = value == radio_item[:value] }
40
40
  end
41
41
 
42
42
  radio_item_class = @options[:form] ? Item::Radio::Form : Inputs::Item::Radio::Tag
@@ -44,7 +44,7 @@ module CCS
44
44
  @radio_items = radio_items.map { |radio_item| radio_item[:divider] ? Item::Divider.new(divider: radio_item[:divider], type: 'radios') : radio_item_class.new(attribute: attribute, form: @options[:form], context: @context, **radio_item) }
45
45
  end
46
46
 
47
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
47
+ # rubocop:enable Metrics/CyclomaticComplexity
48
48
 
49
49
  # Generates the HTML for the GOV.UK Radios component
50
50
  #
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ccs-frontend_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tim-s-ccs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-25 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails