govuk_content_models 12.3.0 → 12.4.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,8 @@
1
+ ## 12.4.0
2
+
3
+ * Allow new drafts to be created from published
4
+ editions having link validation errors.
5
+
1
6
  ## 12.3.0
2
7
 
3
8
  * Show all relevant errors in LinkValidator.
@@ -48,7 +48,7 @@ class Edition
48
48
  validates :version_number, presence: true, uniqueness: {scope: :panopticon_id}
49
49
  validates :panopticon_id, presence: true
50
50
  validates_with SafeHtml
51
- validates_with LinkValidator
51
+ validates_with LinkValidator, on: :update
52
52
 
53
53
  before_save :check_for_archived_artefact
54
54
  before_destroy :destroy_artefact
@@ -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 = "12.3.0"
3
+ VERSION = "12.4.0"
4
4
  end
@@ -83,6 +83,23 @@ class EditionTest < ActiveSupport::TestCase
83
83
  assert_equal programme.parts.count, ProgrammeEdition::DEFAULT_PARTS.length
84
84
  end
85
85
 
86
+ context "link validation" do
87
+ should "not be done when the edition is created" do
88
+ assert_difference 'AnswerEdition.count', 1 do
89
+ FactoryGirl.create(:answer_edition, body: 'abc [foobar](http://foobar.com "hover")')
90
+ end
91
+ end
92
+
93
+ should "be done when an existing edition is updated" do
94
+ edition = FactoryGirl.create(:answer_edition, body: 'abc [foobar](http://foobar.com "hover")')
95
+
96
+ edition.body += "some update"
97
+
98
+ refute edition.valid?
99
+ assert_include edition.errors.full_messages, %q<Body ["Don't include hover text in links. Delete the text in quotation marks eg \\"This appears when you hover over the link.\\""]>
100
+ end
101
+ end
102
+
86
103
  test "it should build a clone" do
87
104
  edition = FactoryGirl.create(:guide_edition,
88
105
  state: "published",
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: 12.3.0
4
+ version: 12.4.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-06-18 00:00:00.000000000 Z
12
+ date: 2014-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -468,7 +468,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
468
468
  version: '0'
469
469
  segments:
470
470
  - 0
471
- hash: -4200899125153312569
471
+ hash: 93890096287418102
472
472
  required_rubygems_version: !ruby/object:Gem::Requirement
473
473
  none: false
474
474
  requirements:
@@ -477,7 +477,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
477
477
  version: '0'
478
478
  segments:
479
479
  - 0
480
- hash: -4200899125153312569
480
+ hash: 93890096287418102
481
481
  requirements: []
482
482
  rubyforge_project:
483
483
  rubygems_version: 1.8.23