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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dc520a74843e9a3ccd9b5a0427b966711f30b5
|
4
|
+
data.tar.gz: 8ba0639769f9c134d133ff996e9d2d41d4d0ed77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1360728473419a672030754f02164c27f17fb790ef0acf0a1abcac89bb659680e778c6c32ecd894d5e219c65a774fe33e322d499dafd337b39e5b08b96d51ca5
|
7
|
+
data.tar.gz: 7651c6ef9eef44d07dabe3ebe997179f1aa20b89d6e26b5d785a89d66e0343c1c22b8f2d699f4d57fd62740fad031cdd60c5f9f2aa7d4dccdb5184ada39f3c7c
|
data/CHANGELOG.md
CHANGED
@@ -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 :
|
20
|
+
before_validation :populate_slug
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def
|
25
|
-
if
|
26
|
-
self.slug = ActiveSupport::Inflector.parameterize(
|
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
|
@@ -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
|
|