govuk_content_models 41.0.0 → 41.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/models/workflow.rb +5 -5
- data/lib/govuk_content_models/action_processors/skip_review_processor.rb +9 -0
- data/lib/govuk_content_models/action_processors.rb +1 -0
- data/lib/govuk_content_models/test_helpers/action_processor_helpers.rb +4 -0
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/edition_test.rb +0 -6
- data/test/models/workflow_test.rb +15 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbcfb829a13e415c1340980483a7fdc28a46b852
|
4
|
+
data.tar.gz: d8a1ae1a225355001e6455992ca58d41d728dad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a2db1e3826a777476146dc6900127b9b8554c675024de35aeef93af1a9c1fa5ec193b3f584f5d76b01062f0f2838c2664af23d4cf0f5a764223d5aee6f6a57
|
7
|
+
data.tar.gz: 3676a0785f93ebcd0164a294d6a5a8dce86d803ec05530f2018ba090389683c6c2bf02fd93f1695aa5e012d86f236b915109238304bdcb37686a72fb6cb59ee8
|
data/CHANGELOG.md
CHANGED
data/app/models/workflow.rb
CHANGED
@@ -28,7 +28,7 @@ module Workflow
|
|
28
28
|
edition.publish_at = nil
|
29
29
|
end
|
30
30
|
|
31
|
-
before_transition on: [:approve_review, :request_amendments] do |edition,
|
31
|
+
before_transition on: [:approve_review, :skip_review, :request_amendments] do |edition, _transition|
|
32
32
|
edition.reviewer = nil
|
33
33
|
end
|
34
34
|
|
@@ -56,6 +56,10 @@ module Workflow
|
|
56
56
|
transition [:fact_check_received, :in_review, :ready, :fact_check] => :amends_needed
|
57
57
|
end
|
58
58
|
|
59
|
+
event :skip_review do
|
60
|
+
transition in_review: :ready
|
61
|
+
end
|
62
|
+
|
59
63
|
# Editions can optionally be sent out for fact check
|
60
64
|
event :send_fact_check do
|
61
65
|
transition [:ready, :fact_check_received] => :fact_check
|
@@ -86,10 +90,6 @@ module Workflow
|
|
86
90
|
transition [:ready, :scheduled_for_publishing] => :published
|
87
91
|
end
|
88
92
|
|
89
|
-
event :emergency_publish do
|
90
|
-
transition draft: :published
|
91
|
-
end
|
92
|
-
|
93
93
|
event :archive do
|
94
94
|
transition all => :archived, :unless => :archived?
|
95
95
|
end
|
@@ -34,6 +34,10 @@ module GovukContentModels
|
|
34
34
|
publish_at: action_attributes[:publish_at] || Time.zone.now.utc,
|
35
35
|
comment: action_attributes[:comment] || 'Schedule!' })
|
36
36
|
end
|
37
|
+
|
38
|
+
def skip_review(user, edition)
|
39
|
+
user.progress(edition, request_type: :skip_review, comment: "Skipping review as this is an out of hours urgent update.")
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
data/test/models/edition_test.rb
CHANGED
@@ -890,12 +890,6 @@ class EditionTest < ActiveSupport::TestCase
|
|
890
890
|
refute edition.can_publish?
|
891
891
|
end
|
892
892
|
|
893
|
-
test "a draft edition can be emergency published" do
|
894
|
-
edition = FactoryGirl.create(:guide_edition, panopticon_id: @artefact.id, state: "draft")
|
895
|
-
assert edition.can_emergency_publish?
|
896
|
-
end
|
897
|
-
|
898
|
-
|
899
893
|
# test denormalisation
|
900
894
|
|
901
895
|
test "should denormalise an edition with an assigned user and action requesters" do
|
@@ -149,6 +149,21 @@ class WorkflowTest < ActiveSupport::TestCase
|
|
149
149
|
assert edition.can_publish?
|
150
150
|
end
|
151
151
|
|
152
|
+
test "skip review workflow" do
|
153
|
+
user = FactoryGirl.create(:user, name: "Ben", permissions: ["skip_review"])
|
154
|
+
other = FactoryGirl.create(:user, name: "Ben", permissions: ["signin"])
|
155
|
+
|
156
|
+
edition = user.create_edition(:guide, title: "My Title", slug: "my-title", panopticon_id: @artefact.id)
|
157
|
+
|
158
|
+
assert edition.can_request_review?
|
159
|
+
request_review(user, edition)
|
160
|
+
assert edition.can_skip_review?
|
161
|
+
refute skip_review(other, edition)
|
162
|
+
assert skip_review(user, edition)
|
163
|
+
assert edition.ready?
|
164
|
+
assert edition.can_publish?
|
165
|
+
end
|
166
|
+
|
152
167
|
test "when fact check has been initiated it can be skipped" do
|
153
168
|
user = FactoryGirl.create(:user, name: "Ben")
|
154
169
|
other_user = FactoryGirl.create(:user, name: "James")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_content_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 41.
|
4
|
+
version: 41.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Battley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson_ext
|
@@ -391,6 +391,7 @@ files:
|
|
391
391
|
- lib/govuk_content_models/action_processors/schedule_for_publishing_processor.rb
|
392
392
|
- lib/govuk_content_models/action_processors/send_fact_check_processor.rb
|
393
393
|
- lib/govuk_content_models/action_processors/skip_fact_check_processor.rb
|
394
|
+
- lib/govuk_content_models/action_processors/skip_review_processor.rb
|
394
395
|
- lib/govuk_content_models/presentation_toggles.rb
|
395
396
|
- lib/govuk_content_models/require_all.rb
|
396
397
|
- lib/govuk_content_models/test_helpers/action_processor_helpers.rb
|