govuk_content_models 27.0.0 → 27.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 27.1.0
2
+
3
+ Updates the LinkValidator to validate smart quotes in the same way as normal quotes
4
+
1
5
  ## 27.0.0
2
6
 
3
7
  - Corrected to return public timestamp of first edition when no major changes
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  class LinkValidator < ActiveModel::Validator
2
4
  def validate(record)
3
5
  record.class::GOVSPEAK_FIELDS.each do |govspeak_field_name|
@@ -21,7 +23,7 @@ class LinkValidator < ActiveModel::Validator
21
23
 
22
24
  errors = Set.new
23
25
 
24
- string.scan(link_regex) do |match|
26
+ string.gsub(/(“|”)+/, '"').scan(link_regex) do |match|
25
27
 
26
28
  if match[0] !~ %r{^(?:https?://|mailto:|/)}
27
29
  errors << 'Internal links must start with a forward slash eg [link text](/link-destination). External links must start with http://, https://, or mailto: eg [external link text](https://www.google.co.uk).'
@@ -1,4 +1,4 @@
1
1
  module GovukContentModels
2
2
  # Changing this causes Jenkins to tag and release the gem into the wild
3
- VERSION = "27.0.0"
3
+ VERSION = "27.1.0"
4
4
  end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class LinkValidatorTest < ActiveSupport::TestCase
@@ -39,6 +41,12 @@ class LinkValidatorTest < ActiveSupport::TestCase
39
41
  assert_includes doc.errors.keys, :body
40
42
  end
41
43
 
44
+ should "validate smart quotes as normal quotes" do
45
+ doc = Dummy.new(body: %q<abc [foobar](http://foobar.com “hover”)>)
46
+ assert doc.invalid?
47
+ assert_includes doc.errors.keys, :body
48
+ end
49
+
42
50
  should "not set rel=external" do
43
51
  doc = Dummy.new(body: 'abc [foobar](http://foobar.com){:rel="external"}')
44
52
  assert doc.invalid?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 27.0.0
4
+ version: 27.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-11 00:00:00.000000000 Z
12
+ date: 2014-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &19617640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
24
+ version_requirements: *19617640
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: gds-api-adapters
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &19615920 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: 10.9.0
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 10.9.0
35
+ version_requirements: *19615920
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: gds-sso
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &19611040 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,15 +43,10 @@ dependencies:
53
43
  version: 10.0.0
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 10.0.0
46
+ version_requirements: *19611040
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: govspeak
64
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &19405300 !ruby/object:Gem::Requirement
65
50
  none: false
66
51
  requirements:
67
52
  - - ~>
@@ -69,15 +54,10 @@ dependencies:
69
54
  version: 3.1.0
70
55
  type: :runtime
71
56
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: 3.1.0
57
+ version_requirements: *19405300
78
58
  - !ruby/object:Gem::Dependency
79
59
  name: mongoid
80
- requirement: !ruby/object:Gem::Requirement
60
+ requirement: &19422380 !ruby/object:Gem::Requirement
81
61
  none: false
82
62
  requirements:
83
63
  - - ~>
@@ -85,15 +65,10 @@ dependencies:
85
65
  version: '2.5'
86
66
  type: :runtime
87
67
  prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- version: '2.5'
68
+ version_requirements: *19422380
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: plek
96
- requirement: !ruby/object:Gem::Requirement
71
+ requirement: &19419000 !ruby/object:Gem::Requirement
97
72
  none: false
98
73
  requirements:
99
74
  - - ! '>='
@@ -101,15 +76,10 @@ dependencies:
101
76
  version: '0'
102
77
  type: :runtime
103
78
  prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
79
+ version_requirements: *19419000
110
80
  - !ruby/object:Gem::Dependency
111
81
  name: state_machine
112
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &19417740 !ruby/object:Gem::Requirement
113
83
  none: false
114
84
  requirements:
115
85
  - - ! '>='
@@ -117,79 +87,54 @@ dependencies:
117
87
  version: '0'
118
88
  type: :runtime
119
89
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
90
+ version_requirements: *19417740
126
91
  - !ruby/object:Gem::Dependency
127
92
  name: database_cleaner
128
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &19415780 !ruby/object:Gem::Requirement
129
94
  none: false
130
95
  requirements:
131
- - - '='
96
+ - - =
132
97
  - !ruby/object:Gem::Version
133
98
  version: 0.7.2
134
99
  type: :development
135
100
  prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - '='
140
- - !ruby/object:Gem::Version
141
- version: 0.7.2
101
+ version_requirements: *19415780
142
102
  - !ruby/object:Gem::Dependency
143
103
  name: factory_girl
144
- requirement: !ruby/object:Gem::Requirement
104
+ requirement: &19415040 !ruby/object:Gem::Requirement
145
105
  none: false
146
106
  requirements:
147
- - - '='
107
+ - - =
148
108
  - !ruby/object:Gem::Version
149
109
  version: 3.3.0
150
110
  type: :development
151
111
  prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
- requirements:
155
- - - '='
156
- - !ruby/object:Gem::Version
157
- version: 3.3.0
112
+ version_requirements: *19415040
158
113
  - !ruby/object:Gem::Dependency
159
114
  name: gem_publisher
160
- requirement: !ruby/object:Gem::Requirement
115
+ requirement: &19518200 !ruby/object:Gem::Requirement
161
116
  none: false
162
117
  requirements:
163
- - - '='
118
+ - - =
164
119
  - !ruby/object:Gem::Version
165
120
  version: 1.2.0
166
121
  type: :development
167
122
  prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
- requirements:
171
- - - '='
172
- - !ruby/object:Gem::Version
173
- version: 1.2.0
123
+ version_requirements: *19518200
174
124
  - !ruby/object:Gem::Dependency
175
125
  name: mocha
176
- requirement: !ruby/object:Gem::Requirement
126
+ requirement: &19515540 !ruby/object:Gem::Requirement
177
127
  none: false
178
128
  requirements:
179
- - - '='
129
+ - - =
180
130
  - !ruby/object:Gem::Version
181
131
  version: 0.13.3
182
132
  type: :development
183
133
  prerelease: false
184
- version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
- requirements:
187
- - - '='
188
- - !ruby/object:Gem::Version
189
- version: 0.13.3
134
+ version_requirements: *19515540
190
135
  - !ruby/object:Gem::Dependency
191
136
  name: multi_json
192
- requirement: !ruby/object:Gem::Requirement
137
+ requirement: &19528860 !ruby/object:Gem::Requirement
193
138
  none: false
194
139
  requirements:
195
140
  - - ! '>='
@@ -197,79 +142,54 @@ dependencies:
197
142
  version: '0'
198
143
  type: :development
199
144
  prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: '0'
145
+ version_requirements: *19528860
206
146
  - !ruby/object:Gem::Dependency
207
147
  name: rake
208
- requirement: !ruby/object:Gem::Requirement
148
+ requirement: &20219280 !ruby/object:Gem::Requirement
209
149
  none: false
210
150
  requirements:
211
- - - '='
151
+ - - =
212
152
  - !ruby/object:Gem::Version
213
153
  version: 0.9.2.2
214
154
  type: :development
215
155
  prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - '='
220
- - !ruby/object:Gem::Version
221
- version: 0.9.2.2
156
+ version_requirements: *20219280
222
157
  - !ruby/object:Gem::Dependency
223
158
  name: webmock
224
- requirement: !ruby/object:Gem::Requirement
159
+ requirement: &20217960 !ruby/object:Gem::Requirement
225
160
  none: false
226
161
  requirements:
227
- - - '='
162
+ - - =
228
163
  - !ruby/object:Gem::Version
229
164
  version: 1.8.7
230
165
  type: :development
231
166
  prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
- requirements:
235
- - - '='
236
- - !ruby/object:Gem::Version
237
- version: 1.8.7
167
+ version_requirements: *20217960
238
168
  - !ruby/object:Gem::Dependency
239
169
  name: shoulda-context
240
- requirement: !ruby/object:Gem::Requirement
170
+ requirement: &20216640 !ruby/object:Gem::Requirement
241
171
  none: false
242
172
  requirements:
243
- - - '='
173
+ - - =
244
174
  - !ruby/object:Gem::Version
245
175
  version: 1.0.0
246
176
  type: :development
247
177
  prerelease: false
248
- version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
- requirements:
251
- - - '='
252
- - !ruby/object:Gem::Version
253
- version: 1.0.0
178
+ version_requirements: *20216640
254
179
  - !ruby/object:Gem::Dependency
255
180
  name: timecop
256
- requirement: !ruby/object:Gem::Requirement
181
+ requirement: &20215040 !ruby/object:Gem::Requirement
257
182
  none: false
258
183
  requirements:
259
- - - '='
184
+ - - =
260
185
  - !ruby/object:Gem::Version
261
186
  version: 0.5.9.2
262
187
  type: :development
263
188
  prerelease: false
264
- version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
- requirements:
267
- - - '='
268
- - !ruby/object:Gem::Version
269
- version: 0.5.9.2
189
+ version_requirements: *20215040
270
190
  - !ruby/object:Gem::Dependency
271
191
  name: debugger
272
- requirement: !ruby/object:Gem::Requirement
192
+ requirement: &20212320 !ruby/object:Gem::Requirement
273
193
  none: false
274
194
  requirements:
275
195
  - - ! '>='
@@ -277,15 +197,10 @@ dependencies:
277
197
  version: '0'
278
198
  type: :development
279
199
  prerelease: false
280
- version_requirements: !ruby/object:Gem::Requirement
281
- none: false
282
- requirements:
283
- - - ! '>='
284
- - !ruby/object:Gem::Version
285
- version: '0'
200
+ version_requirements: *20212320
286
201
  - !ruby/object:Gem::Dependency
287
202
  name: rack
288
- requirement: !ruby/object:Gem::Requirement
203
+ requirement: &20225460 !ruby/object:Gem::Requirement
289
204
  none: false
290
205
  requirements:
291
206
  - - ~>
@@ -293,28 +208,18 @@ dependencies:
293
208
  version: 1.4.4
294
209
  type: :development
295
210
  prerelease: false
296
- version_requirements: !ruby/object:Gem::Requirement
297
- none: false
298
- requirements:
299
- - - ~>
300
- - !ruby/object:Gem::Version
301
- version: 1.4.4
211
+ version_requirements: *20225460
302
212
  - !ruby/object:Gem::Dependency
303
213
  name: rails
304
- requirement: !ruby/object:Gem::Requirement
214
+ requirement: &20222080 !ruby/object:Gem::Requirement
305
215
  none: false
306
216
  requirements:
307
- - - '='
217
+ - - =
308
218
  - !ruby/object:Gem::Version
309
219
  version: 3.2.17
310
220
  type: :development
311
221
  prerelease: false
312
- version_requirements: !ruby/object:Gem::Requirement
313
- none: false
314
- requirements:
315
- - - '='
316
- - !ruby/object:Gem::Version
317
- version: 3.2.17
222
+ version_requirements: *20222080
318
223
  description: Shared models for Panopticon and Publisher
319
224
  email:
320
225
  - pbattley@gmail.com
@@ -475,7 +380,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
475
380
  version: '0'
476
381
  segments:
477
382
  - 0
478
- hash: 1210122604192578351
383
+ hash: -2893959109595169673
479
384
  required_rubygems_version: !ruby/object:Gem::Requirement
480
385
  none: false
481
386
  requirements:
@@ -484,10 +389,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
484
389
  version: '0'
485
390
  segments:
486
391
  - 0
487
- hash: 1210122604192578351
392
+ hash: -2893959109595169673
488
393
  requirements: []
489
394
  rubyforge_project:
490
- rubygems_version: 1.8.23
395
+ rubygems_version: 1.8.11
491
396
  signing_key:
492
397
  specification_version: 3
493
398
  summary: Shared models for Panopticon and Publisher, as a Rails Engine