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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a665f9f898baa89d155ed724cf36c4a489aedb0
4
- data.tar.gz: e13f1d9f21a351ce972c7e881120cbbcd0501755
3
+ metadata.gz: dbcfb829a13e415c1340980483a7fdc28a46b852
4
+ data.tar.gz: d8a1ae1a225355001e6455992ca58d41d728dad8
5
5
  SHA512:
6
- metadata.gz: 644d193130ee66d93516633f457308cc9236498cf1ffe836d431fb24b7c253a735c4b8ff388be7086be27a3747cfb1c7720457240b3b02970eff27f1598ae653
7
- data.tar.gz: 5b814b44410cc7ac2554ad8a85ba1d80beec9d83406a9f70980c9442a98bc2d7cb11e7e59bc0ad358634ae3a49df1464a4def76483568bd373e262b4fff0cda9
6
+ metadata.gz: 84a2db1e3826a777476146dc6900127b9b8554c675024de35aeef93af1a9c1fa5ec193b3f584f5d76b01062f0f2838c2664af23d4cf0f5a764223d5aee6f6a57
7
+ data.tar.gz: 3676a0785f93ebcd0164a294d6a5a8dce86d803ec05530f2018ba090389683c6c2bf02fd93f1695aa5e012d86f236b915109238304bdcb37686a72fb6cb59ee8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 41.1.0
4
+
5
+ - Adds 'skip review' Edition workflow processor
6
+
3
7
  ## 41.0.0
4
8
 
5
9
  - Add start button text attribute for SimpleSmartAnswerEdition
@@ -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, transition|
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
@@ -0,0 +1,9 @@
1
+ module GovukContentModels
2
+ module ActionProcessors
3
+ class SkipReviewProcessor < BaseProcessor
4
+ def process?
5
+ actor.permissions.include?("skip_review")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -18,6 +18,7 @@ module GovukContentModels
18
18
  publish: 'PublishProcessor',
19
19
  archive: 'ArchiveProcessor',
20
20
  new_version: 'NewVersionProcessor',
21
+ skip_review: 'SkipReviewProcessor',
21
22
  }
22
23
  end
23
24
  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
@@ -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 = "41.0.0"
3
+ VERSION = "41.1.0"
4
4
  end
@@ -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.0.0
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-09-01 00:00:00.000000000 Z
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