govuk_content_models 40.0.0 → 41.0.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: 1f18d1ebea02b0584a44cc7500640d06c5efdba7
4
- data.tar.gz: fa423d6bdd018aa1d6dd1abe503698af37ec8ef4
3
+ metadata.gz: 7a665f9f898baa89d155ed724cf36c4a489aedb0
4
+ data.tar.gz: e13f1d9f21a351ce972c7e881120cbbcd0501755
5
5
  SHA512:
6
- metadata.gz: 6d9b3ec85affef521cbc59d2392600d19804748441bd33e1865b385196f0617fa6844ce5c996a893ff481511e644868f19e0b8ad757724339a84b497fafffc9f
7
- data.tar.gz: fbc5963565ffcb19f4134f846fbac1b5519f47151d9c5c9a48e50a1958e69ea4953d831bdba5c2fe7e14486726458fb2d0f24ed112ad1fdabe01c6d60affddef
6
+ metadata.gz: 644d193130ee66d93516633f457308cc9236498cf1ffe836d431fb24b7c253a735c4b8ff388be7086be27a3747cfb1c7720457240b3b02970eff27f1598ae653
7
+ data.tar.gz: 5b814b44410cc7ac2554ad8a85ba1d80beec9d83406a9f70980c9442a98bc2d7cb11e7e59bc0ad358634ae3a49df1464a4def76483568bd373e262b4fff0cda9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 41.0.0
4
+
5
+ - Add start button text attribute for SimpleSmartAnswerEdition
6
+
3
7
  ## 40.0.0
4
8
 
5
9
  - Removed `need_extended_font` attribute
@@ -5,7 +5,10 @@ require_relative 'simple_smart_answer_edition/node/option'
5
5
  class SimpleSmartAnswerEdition < Edition
6
6
  include Mongoid::Document
7
7
 
8
- field :body, type: String
8
+ field :body, type: String
9
+ field :start_button_text, type: String, default: "Start now"
10
+
11
+ validates_presence_of :start_button_text
9
12
 
10
13
  embeds_many :nodes, :class_name => "SimpleSmartAnswerEdition::Node"
11
14
 
@@ -34,11 +37,11 @@ class SimpleSmartAnswerEdition < Edition
34
37
 
35
38
  # Workaround mongoid conflicting mods error
36
39
  # See https://jira.mongodb.org/browse/MONGOID-1220
37
- # Override update_attributes so that nested nodes are updated individually.
38
- # This get around the problem of mongoid issuing a query with conflicting modifications
39
- # to the same document.
40
+ # Override update_attributes so that nested nodes are updated individually.
41
+ # This get around the problem of mongoid issuing a query with conflicting modifications
42
+ # to the same document.
40
43
  alias_method :original_update_attributes, :update_attributes
41
-
44
+
42
45
  def update_attributes(attributes)
43
46
  if nodes_attrs = attributes.delete(:nodes_attributes)
44
47
  nodes_attrs.each do |index, node_attrs|
@@ -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 = "40.0.0"
3
+ VERSION = "41.0.0"
4
4
  end
@@ -100,6 +100,48 @@ class SimpleSmartAnswerEditionTest < ActiveSupport::TestCase
100
100
  assert_equal 1, edition.nodes.size
101
101
  end
102
102
 
103
+ context "SimpleSmartAnswerEdition: Start Button" do
104
+ setup do
105
+ @edition_attributes = {
106
+ panopticon_id: @artefact.id,
107
+ body: "This is a simple smart answer with a default text for start button."
108
+ }
109
+ end
110
+ context "with default text" do
111
+ setup do
112
+ edition = FactoryGirl.build(:simple_smart_answer_edition, @edition_attributes)
113
+ edition.save!
114
+ end
115
+
116
+ should "be created with the default text for start button" do
117
+ edition = SimpleSmartAnswerEdition.first
118
+
119
+ assert_equal "Start now", edition.start_button_text
120
+ assert_equal "This is a simple smart answer with a default text for start button.", edition.body
121
+ assert_equal @artefact.id.to_s, edition.panopticon_id
122
+ end
123
+ end
124
+
125
+ context "when button text changes" do
126
+ setup do
127
+ edition = FactoryGirl.build(
128
+ :simple_smart_answer_edition,
129
+ @edition_attributes.merge(start_button_text: "Click to start")
130
+ )
131
+ edition.save!
132
+ end
133
+
134
+ should "be created with the text given by the content creator" do
135
+ edition = SimpleSmartAnswerEdition.first
136
+
137
+ refute_equal "Start Now", edition.start_button_text
138
+ assert_equal "Click to start", edition.start_button_text
139
+ assert_equal "This is a simple smart answer with a default text for start button.", edition.body
140
+ assert_equal @artefact.id.to_s, edition.panopticon_id
141
+ end
142
+ end
143
+ end
144
+
103
145
  context "update_attributes method" do
104
146
  setup do
105
147
  @edition = FactoryGirl.create(:simple_smart_answer_edition)
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: 40.0.0
4
+ version: 41.0.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-08-15 00:00:00.000000000 Z
11
+ date: 2016-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext