govuk_content_models 31.4.0 → 32.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40258d79cad346c7ad24fd75eab16db040358d7c
4
- data.tar.gz: fbcb1c49048321f69113c637c9abdd16a00391f8
3
+ metadata.gz: 6af733bb83f5e4d60a3c405a5492056904e47122
4
+ data.tar.gz: e5f073c62dd6f5ed47794f3d25e0ea2a82fd7407
5
5
  SHA512:
6
- metadata.gz: be04aedd7bb95a1523e44da86185e2004fd21b2dc5fc916e814ea9deee7c4d34e9b3137e7d7c19322e69b6b5f9a715c75b480839b879af8c7456be4289bce41b
7
- data.tar.gz: 535ca3d75b80953e884fd95cdb8d21cd2b36150f01981b50da64111943288626c9415e82762e81e2c557b8d2409738664d24eee910280ed21fd23af84a0b26ee
6
+ metadata.gz: a94e635fc55b8526aac787f1d7f72e27e198d9f09704a7c4c577d4cd4668ebe3f3d3d78a4e5de52686c9b34dcb8ab3700801228ae6b82b822209fcae4d5a86d9
7
+ data.tar.gz: 547d3b7c4ae53e4e8715e1d8e53df28190a884e112bd6349c4c3f1555c9f3f929fa04645c77258cd71c6b62b47482ffe72edc2ff02c1893b02673a7777d8b613
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 32.0.0
4
+
5
+ - Add body and default parts to mainstream format factories
6
+ - Remove areas field from BusinessSupportEditions and replace with area_gss_codes, which are more stable
7
+
3
8
  ## 31.4.0
4
9
 
5
10
  - Allow URLs with fragments in Artefact#redirect_url
@@ -28,7 +28,6 @@ class BusinessSupportEdition < Edition
28
28
  field :support_types, type: Array, default: []
29
29
  field :start_date, type: Date
30
30
  field :end_date, type: Date
31
- field :areas, type: Array, default: []
32
31
  field :area_gss_codes, type: Array, default: []
33
32
 
34
33
  GOVSPEAK_FIELDS = [:body, :eligibility, :evaluation, :additional_information]
@@ -46,7 +45,7 @@ class BusinessSupportEdition < Edition
46
45
 
47
46
 
48
47
  def whole_body
49
- [short_description, body].join("\n\n")
48
+ [short_description, body, additional_information].join("\n\n")
50
49
  end
51
50
 
52
51
  private
@@ -211,6 +211,7 @@ class Edition
211
211
 
212
212
  def clone_whole_body_from(origin_edition)
213
213
  if self.respond_to?(:parts)
214
+ self.setup_default_parts if self.respond_to?(:setup_default_parts)
214
215
  self.parts.build(title: "Part One", body: origin_edition.whole_body, slug: "part-one")
215
216
  elsif self.respond_to?(:more_information=)
216
217
  self.more_information = origin_edition.whole_body
@@ -114,20 +114,25 @@ FactoryGirl.define do
114
114
  trait :published do
115
115
  state 'published'
116
116
  end
117
+
118
+ trait :with_body do
119
+ body 'Some body text'
120
+ end
121
+
117
122
  end
118
- factory :answer_edition, parent: :edition do
123
+ factory :answer_edition, traits: [:with_body], parent: :edition do
119
124
  end
120
125
 
121
- factory :help_page_edition, :parent => :edition, :class => 'HelpPageEdition' do
126
+ factory :help_page_edition, traits: [:with_body], :parent => :edition, :class => 'HelpPageEdition' do
122
127
  end
123
128
 
124
- factory :campaign_edition, :parent => :edition, :class => 'CampaignEdition' do
129
+ factory :campaign_edition, traits: [:with_body], :parent => :edition, :class => 'CampaignEdition' do
125
130
  end
126
131
 
127
- factory :completed_transaction_edition, :parent => :edition, :class => 'CompletedTransactionEdition' do
132
+ factory :completed_transaction_edition, traits: [:with_body], :parent => :edition, :class => 'CompletedTransactionEdition' do
128
133
  end
129
134
 
130
- factory :video_edition, parent: :edition, :class => 'VideoEdition' do
135
+ factory :video_edition, traits: [:with_body], parent: :edition, :class => 'VideoEdition' do
131
136
  end
132
137
 
133
138
  factory :business_support_edition, :parent => :edition, :class => "BusinessSupportEdition" do
@@ -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 = "31.4.0"
3
+ VERSION = "32.0.0"
4
4
  end
@@ -25,7 +25,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
25
25
  support.contact_details = "123 The Street, Townsville, UK. 07324 123456"
26
26
 
27
27
  support.priority = 2
28
- support.areas = ["123","345","45","9"]
29
28
  support.area_gss_codes = ["G123","G345","G45","G9"]
30
29
  support.business_sizes << "up-to-249"
31
30
  support.business_types << "charity"
@@ -55,7 +54,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
55
54
 
56
55
  assert_equal 2, support.priority
57
56
 
58
- assert_equal ["123","345","45","9"], support.areas
59
57
  assert_equal ["G123","G345","G45","G9"], support.area_gss_codes
60
58
  assert_equal ["up-to-249"], support.business_sizes
61
59
  assert_equal ["charity"], support.business_types
@@ -153,7 +151,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
153
151
  :continuation_link => "http://www.gov.uk",
154
152
  :contact_details => "Contact details to be cloned",
155
153
  :priority => 2,
156
- :areas => ['123','9999'],
157
154
  :area_gss_codes => ['G123','G9999'],
158
155
  :business_sizes => ['up-to-249'],
159
156
  :locations => ['london'],
@@ -181,7 +178,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
181
178
  assert_equal support.contact_details, new_support.contact_details
182
179
 
183
180
  assert_equal support.priority, new_support.priority
184
- assert_equal support.areas, new_support.areas
185
181
  assert_equal support.area_gss_codes, new_support.area_gss_codes
186
182
  assert_equal support.business_sizes, new_support.business_sizes
187
183
  assert_equal support.locations, new_support.locations
@@ -197,7 +193,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
197
193
  setup do
198
194
  @e1 = FactoryGirl.create(
199
195
  :business_support_edition,
200
- :areas => ['2345', '1234'],
201
196
  :area_gss_codes => ['G2345', 'G1234'],
202
197
  :business_sizes => ['1', 'up-to-1000000'],
203
198
  :locations => ['narnia'],
@@ -208,7 +203,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
208
203
  )
209
204
  @e2 = FactoryGirl.create(
210
205
  :business_support_edition,
211
- :areas => ['1212', '1234', '999'],
212
206
  :area_gss_codes => ['G1212', 'G1234', 'G999'],
213
207
  :business_sizes => ['1', 'up-to-1000000'],
214
208
  :locations => ['hades', 'narnia'],
@@ -219,7 +213,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
219
213
  )
220
214
  @e3 = FactoryGirl.create(
221
215
  :business_support_edition,
222
- :areas => ['1234'],
223
216
  :area_gss_codes => ['G1234'],
224
217
  :business_sizes => ['up-to-249', 'up-to-1000000'],
225
218
  :locations => ['hades', 'chicken-town'],
@@ -244,7 +237,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
244
237
  end
245
238
  should "support searching with all the facet values" do
246
239
  editions = BusinessSupportEdition.for_facets({
247
- :areas => '1234',
248
240
  :area_gss_codes => 'G1234',
249
241
  :business_sizes => 'up-to-1000000',
250
242
  :locations => 'narnia,hades,chicken-town',
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: 31.4.0
4
+ version: 32.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: 2015-10-29 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext