govuk_content_models 10.5.0 → 11.0.0
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.
- data/CHANGELOG.md +5 -0
- data/app/models/edition.rb +0 -5
- data/app/models/specialist_document_edition.rb +0 -1
- data/app/models/workflow_actor.rb +0 -2
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/workflow_test.rb +1 -1
- metadata +4 -7
- data/lib/fact_check_address.rb +0 -36
- data/test/models/fact_check_address_test.rb +0 -36
data/CHANGELOG.md
CHANGED
data/app/models/edition.rb
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require "workflow"
|
|
2
|
-
require "fact_check_address"
|
|
3
2
|
|
|
4
3
|
class Edition
|
|
5
4
|
include Mongoid::Document
|
|
@@ -106,10 +105,6 @@ class Edition
|
|
|
106
105
|
PublicationMetadata.new self
|
|
107
106
|
end
|
|
108
107
|
|
|
109
|
-
def fact_check_email_address
|
|
110
|
-
FactCheckAddress.new.for_edition(self)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
108
|
def get_next_version_number
|
|
114
109
|
latest_version = series.order(version_number: "desc").first.version_number
|
|
115
110
|
latest_version + 1
|
|
@@ -89,8 +89,6 @@ module WorkflowActor
|
|
|
89
89
|
return false if details[:email_addresses].blank?
|
|
90
90
|
|
|
91
91
|
details[:comment] ||= "Fact check requested"
|
|
92
|
-
details[:comment] += "\n\nResponses should be sent to: " +
|
|
93
|
-
edition.fact_check_email_address
|
|
94
92
|
|
|
95
93
|
take_action(edition, __method__, details)
|
|
96
94
|
end
|
|
@@ -181,7 +181,7 @@ class WorkflowTest < ActiveSupport::TestCase
|
|
|
181
181
|
user.receive_fact_check(edition, {comment: "Text.<l>content that the SafeHtml validator would catch</l>"})
|
|
182
182
|
user.send_fact_check(edition,{comment: "Out of office reply triggered receive_fact_check", email_addresses: "test@test.com"})
|
|
183
183
|
|
|
184
|
-
assert(edition.actions.last.comment.include? "Out of office reply triggered receive_fact_check
|
|
184
|
+
assert(edition.actions.last.comment.include? "Out of office reply triggered receive_fact_check")
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
test "when processing fact check, an edition can request for amendments" do
|
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:
|
|
4
|
+
version: 11.0.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-05-
|
|
12
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bson_ext
|
|
@@ -397,7 +397,6 @@ files:
|
|
|
397
397
|
- govuk_content_models.gemspec
|
|
398
398
|
- jenkins.sh
|
|
399
399
|
- jenkins_branches.sh
|
|
400
|
-
- lib/fact_check_address.rb
|
|
401
400
|
- lib/govuk_content_models.rb
|
|
402
401
|
- lib/govuk_content_models/require_all.rb
|
|
403
402
|
- lib/govuk_content_models/test_helpers/factories.rb
|
|
@@ -424,7 +423,6 @@ files:
|
|
|
424
423
|
- test/models/curated_list_test.rb
|
|
425
424
|
- test/models/edition_scheduled_for_publishing_test.rb
|
|
426
425
|
- test/models/edition_test.rb
|
|
427
|
-
- test/models/fact_check_address_test.rb
|
|
428
426
|
- test/models/help_page_edition_test.rb
|
|
429
427
|
- test/models/licence_edition_test.rb
|
|
430
428
|
- test/models/local_authority_test.rb
|
|
@@ -465,7 +463,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
465
463
|
version: '0'
|
|
466
464
|
segments:
|
|
467
465
|
- 0
|
|
468
|
-
hash:
|
|
466
|
+
hash: -2782953638830349202
|
|
469
467
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
470
468
|
none: false
|
|
471
469
|
requirements:
|
|
@@ -474,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
474
472
|
version: '0'
|
|
475
473
|
segments:
|
|
476
474
|
- 0
|
|
477
|
-
hash:
|
|
475
|
+
hash: -2782953638830349202
|
|
478
476
|
requirements: []
|
|
479
477
|
rubyforge_project:
|
|
480
478
|
rubygems_version: 1.8.23
|
|
@@ -502,7 +500,6 @@ test_files:
|
|
|
502
500
|
- test/models/curated_list_test.rb
|
|
503
501
|
- test/models/edition_scheduled_for_publishing_test.rb
|
|
504
502
|
- test/models/edition_test.rb
|
|
505
|
-
- test/models/fact_check_address_test.rb
|
|
506
503
|
- test/models/help_page_edition_test.rb
|
|
507
504
|
- test/models/licence_edition_test.rb
|
|
508
505
|
- test/models/local_authority_test.rb
|
data/lib/fact_check_address.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require "plek"
|
|
2
|
-
|
|
3
|
-
class FactCheckAddress
|
|
4
|
-
DOMAIN = "alphagov.co.uk"
|
|
5
|
-
|
|
6
|
-
def for_edition(edition)
|
|
7
|
-
"#{prefix}#{edition.id}@#{DOMAIN}"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def valid_address?(address)
|
|
11
|
-
regexp.match(address)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def edition_id_from_address(address)
|
|
15
|
-
match = valid_address?(address)
|
|
16
|
-
match && match[1]
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
def regexp
|
|
21
|
-
/#{Regexp.escape(prefix)}(.+?)@#{DOMAIN}/
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def prefix
|
|
25
|
-
"factcheck+#{environment}-"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Fact check email addresses are environment dependent. This is
|
|
29
|
-
# a bad thing, but changing it would be very disruptive. Since
|
|
30
|
-
# Plek no longer gives us access to the environment we have to rely
|
|
31
|
-
# on the fact that the environment is included in the public domain
|
|
32
|
-
# name for an app.
|
|
33
|
-
def environment
|
|
34
|
-
Plek.current.find('publisher').split('.')[1]
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "fact_check_address"
|
|
3
|
-
|
|
4
|
-
class FactCheckAddressTest < ActiveSupport::TestCase
|
|
5
|
-
|
|
6
|
-
setup do
|
|
7
|
-
dummy_plek = mock do
|
|
8
|
-
stubs(:find).with("publisher").returns("publisher.wibble.alphagov.co.uk")
|
|
9
|
-
end
|
|
10
|
-
Plek.stubs(:current).returns(dummy_plek)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
test "can tell if an address is valid" do
|
|
14
|
-
service = FactCheckAddress.new
|
|
15
|
-
address = service.for_edition(Edition.new)
|
|
16
|
-
assert service.valid_address?(address), "Address should be valid but isn't"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
test "can tell if an address is invalid" do
|
|
20
|
-
service = FactCheckAddress.new
|
|
21
|
-
address = "factcheck+notwibble-abde@alphagov.co.uk"
|
|
22
|
-
refute service.valid_address?(address), "Address should be invalid but isn't"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
test "can extract edition ID from an address" do
|
|
26
|
-
service = FactCheckAddress.new
|
|
27
|
-
address = "factcheck+wibble-abde@alphagov.co.uk"
|
|
28
|
-
assert_equal "abde", service.edition_id_from_address(address)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
test "can generate an address from an edition" do
|
|
32
|
-
service = FactCheckAddress.new
|
|
33
|
-
e = Edition.new
|
|
34
|
-
assert_match /#{e.id}/, service.for_edition(e)
|
|
35
|
-
end
|
|
36
|
-
end
|