govuk_content_models 12.4.0 → 13.0.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
+ ## 13.0.0
2
+
3
+ * Bundle metadata fields for `RenderedSpecialistDocument` into a single
4
+ `details` hash.
5
+
1
6
  ## 12.4.0
2
7
 
3
8
  * Allow new drafts to be created from published
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- source 'https://BnrJb6FZyzspBboNJzYZ@gem.fury.io/govuk/'
3
2
 
4
3
  gemspec
@@ -5,22 +5,12 @@ class RenderedSpecialistDocument
5
5
  include Mongoid::Timestamps
6
6
  extend PrerenderedEntity
7
7
 
8
- field :document_id, type: String
9
8
  field :slug, type: String
10
9
  field :title, type: String
11
10
  field :summary, type: String
12
11
  field :body, type: String
13
- field :opened_date, type: Date
14
- field :closed_date, type: Date
15
- field :case_type, type: String
16
- field :case_type_label, type: String
17
- field :case_state, type: String
18
- field :case_state_label, type: String
19
- field :market_sector, type: String
20
- field :market_sector_label, type: String
21
- field :outcome_type, type: String
22
- field :outcome_type_label, type: String
23
- field :headers, type: Array
12
+
13
+ field :details, type: Hash
24
14
 
25
15
  index "slug", unique: true
26
16
 
@@ -238,10 +238,12 @@ FactoryGirl.define do
238
238
  sequence(:title) {|n| "Test Rendered Specialist Document #{n}" }
239
239
  summary "My summary"
240
240
  body "<p>My body</p>"
241
- opened_date '2013-04-20'
242
- market_sector 'some-market-sector'
243
- case_type 'a-case-type'
244
- case_state 'open'
241
+ details({
242
+ "opened_date" => "2013-04-20",
243
+ "market_sector" => "some-market-sector",
244
+ "case_type" => "a-case-type",
245
+ "case_state" => "open",
246
+ })
245
247
  end
246
248
 
247
249
  factory :rendered_manual 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 = "12.4.0"
3
+ VERSION = "13.0.0"
4
4
  end
@@ -9,65 +9,4 @@ class RenderedSpecialistDocumentTest < ActiveSupport::TestCase
9
9
  def model_class
10
10
  RenderedSpecialistDocument
11
11
  end
12
-
13
- def label_fields
14
- {
15
- case_type_label: "Some case type",
16
- case_state_label: "Open",
17
- market_sector_label: "Oil and gas",
18
- outcome_type_label: "Referred"
19
- }
20
- end
21
-
22
- def rendered_specialist_document_attributes
23
- basic_specialist_document_fields
24
- .reject { |k,v| k == :state }
25
- .merge(label_fields)
26
- end
27
-
28
- test "can instantiate with basic attributes" do
29
- r = RenderedSpecialistDocument.new(rendered_specialist_document_attributes)
30
- rendered_specialist_document_attributes.each do |k,v|
31
- if (k =~ /date$/)
32
- assert_equal Date.parse(v), r.public_send(k.to_sym)
33
- else
34
- assert_equal v, r.public_send(k.to_sym)
35
- end
36
- end
37
- end
38
-
39
- test "can assign basic attributes" do
40
- r = RenderedSpecialistDocument.new
41
- rendered_specialist_document_attributes.each do |k,v|
42
- r.public_send(:"#{k}=", v)
43
- if (k =~ /date$/)
44
- assert_equal Date.parse(v), r.public_send(k.to_sym)
45
- else
46
- assert_equal v, r.public_send(k.to_sym)
47
- end
48
- end
49
- end
50
-
51
- test "can persist" do
52
- r = RenderedSpecialistDocument.new(rendered_specialist_document_attributes)
53
- r.save!
54
-
55
- assert_equal 1, RenderedSpecialistDocument.where(slug: r.slug).count
56
- end
57
-
58
- test "can store headers hash" do
59
- sample_headers = [
60
- {
61
- "text" => "Phase 1",
62
- "level" => 2,
63
- "id" => "phase-1",
64
- "headers" => []
65
- }
66
- ]
67
- sample_fields = rendered_specialist_document_attributes.merge(headers: sample_headers)
68
- r = RenderedSpecialistDocument.create!(sample_fields)
69
-
70
- found = RenderedSpecialistDocument.where(slug: r.slug).first
71
- assert_equal sample_headers, found.headers
72
- end
73
12
  end
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.4.0
4
+ version: 13.0.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-24 00:00:00.000000000 Z
12
+ date: 2014-06-27 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: 93890096287418102
471
+ hash: -4378837483235683997
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: 93890096287418102
480
+ hash: -4378837483235683997
481
481
  requirements: []
482
482
  rubyforge_project:
483
483
  rubygems_version: 1.8.23