govuk_content_models 14.0.1 → 14.1.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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 14.1.0
2
+ * Edition errors should not block receiving of
3
+ fact check response, and related state transition.
4
+
1
5
  ## 14.0.1
2
6
  * Valdations for Business support scheme dates.
3
7
 
@@ -93,10 +93,13 @@ module WorkflowActor
93
93
  take_action(edition, __method__, details)
94
94
  end
95
95
 
96
- # Advances state if possible (i.e. if in "fact_check" state)
97
96
  # Always records the action.
98
97
  def receive_fact_check(edition, details)
99
- edition.receive_fact_check
98
+ # advance state if possible (i.e. if in "fact_check" state),
99
+ # save separately without validation
100
+ # http://rubydoc.info/github/pluginaweek/state_machine/StateMachine/Machine:event
101
+ edition.state_event = :receive_fact_check
102
+ edition.save(validate: false)
100
103
  # Fact checks are processed async, so the user doesn't get an opportunity
101
104
  # to retry without the content that (inadvertantly) fails validation, which happens frequently.
102
105
  record_action_without_validation(edition, :receive_fact_check, details)
@@ -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 = "14.0.1"
3
+ VERSION = "14.1.0"
4
4
  end
@@ -58,6 +58,18 @@ class WorkflowActorTest < ActiveSupport::TestCase
58
58
  end
59
59
  end
60
60
 
61
+ context "#receive_fact_check" do
62
+ should "transition an edition with link validation errors to fact_check_received state" do
63
+ edition = FactoryGirl.create(:guide_edition_with_two_parts, state: :fact_check)
64
+ # Internal links must start with a forward slash eg [link text](/link-destination)
65
+ edition.parts.first.update_attribute(:body, "[register and tax your vehicle](registering-an-imported-vehicle)")
66
+
67
+ assert edition.invalid?
68
+ assert User.new.receive_fact_check(edition, {})
69
+ assert_equal "fact_check_received", edition.reload.state
70
+ end
71
+ end
72
+
61
73
  context "#schedule_for_publishing" do
62
74
  setup do
63
75
  @user = FactoryGirl.build(:user)
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: 14.0.1
4
+ version: 14.1.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-07-07 00:00:00.000000000 Z
12
+ date: 2014-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -466,7 +466,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
466
466
  version: '0'
467
467
  segments:
468
468
  - 0
469
- hash: 2796015811550823768
469
+ hash: -941845765885480404
470
470
  required_rubygems_version: !ruby/object:Gem::Requirement
471
471
  none: false
472
472
  requirements:
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
475
475
  version: '0'
476
476
  segments:
477
477
  - 0
478
- hash: 2796015811550823768
478
+ hash: -941845765885480404
479
479
  requirements: []
480
480
  rubyforge_project:
481
481
  rubygems_version: 1.8.23