govuk_content_models 29.1.0 → 29.1.1

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: a121fff0d81773c3acfd3666904c3b81770213fa
4
- data.tar.gz: 10b3f0778399eb518163df1cffd4b70e84572b61
3
+ metadata.gz: 50dc520a74843e9a3ccd9b5a0427b966711f30b5
4
+ data.tar.gz: 8ba0639769f9c134d133ff996e9d2d41d4d0ed77
5
5
  SHA512:
6
- metadata.gz: c54a371b42da309fce13c72b3be6085b5e90005aa93d92b8c7d33d3d176cbc1fae047d4556a0b06bad938efe4fb6dfca5ce5b090e8489350b9a538de00efedb8
7
- data.tar.gz: ac2f04839f067d3801fb17691df3293d9c1a2ddf6a3c0296571e2c30fe97b23b7a678bd9183eeb69c317549edda3f0355d1e82f2097d1a66fbd5b2beabf7d7f1
6
+ metadata.gz: 1360728473419a672030754f02164c27f17fb790ef0acf0a1abcac89bb659680e778c6c32ecd894d5e219c65a774fe33e322d499dafd337b39e5b08b96d51ca5
7
+ data.tar.gz: 7651c6ef9eef44d07dabe3ebe997179f1aa20b89d6e26b5d785a89d66e0343c1c22b8f2d699f4d57fd62740fad031cdd60c5f9f2aa7d4dccdb5184ada39f3c7c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 29.1.1
4
+
5
+ - Bugfix: update question options slugs when their labels are updated
6
+
3
7
  ## 29.1.0
8
+
4
9
  - Allow detailed guide slugs to start with /guidance
5
10
 
6
11
  ## 29.0.1
@@ -17,13 +17,13 @@ class SimpleSmartAnswerEdition < Edition
17
17
  validates :label, :next_node, presence: true
18
18
  validates :slug, :format => {:with => /\A[a-z0-9-]+\z/}
19
19
 
20
- before_validation :populate_slug_if_blank
20
+ before_validation :populate_slug
21
21
 
22
22
  private
23
23
 
24
- def populate_slug_if_blank
25
- if self.slug.blank? and self.label.present?
26
- self.slug = ActiveSupport::Inflector.parameterize(self.label)
24
+ def populate_slug
25
+ if label.present? && !slug_changed?
26
+ self.slug = ActiveSupport::Inflector.parameterize(label)
27
27
  end
28
28
  end
29
29
  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 = "29.1.0"
3
+ VERSION = "29.1.1"
4
4
  end
@@ -66,6 +66,13 @@ class SimpleSmartAnswerOptionTest < ActiveSupport::TestCase
66
66
  assert_equal "yes", @option.slug
67
67
  end
68
68
 
69
+ should "keep the slug up to date if the label changes" do
70
+ @option = @node.options.create(@atts.merge(slug: "most-likely"))
71
+ @option.label = "Most of the times"
72
+ assert @option.valid?
73
+ assert_equal "most-of-the-times", @option.slug
74
+ end
75
+
69
76
  should "not overwrite a given slug" do
70
77
  @option = @node.options.build(@atts.merge(:slug => "fooey"))
71
78
 
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: 29.1.0
4
+ version: 29.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley