govuk_content_models 8.8.0 → 8.9.0
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -2,17 +2,22 @@ class RenderedSpecialistDocument
|
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
4
|
|
5
|
-
field :
|
6
|
-
field :
|
7
|
-
field :
|
8
|
-
field :
|
9
|
-
field :
|
10
|
-
field :
|
11
|
-
field :
|
12
|
-
field :
|
13
|
-
field :
|
14
|
-
field :
|
15
|
-
field :
|
5
|
+
field :document_id, type: String
|
6
|
+
field :slug, type: String
|
7
|
+
field :title, type: String
|
8
|
+
field :summary, type: String
|
9
|
+
field :body, type: String
|
10
|
+
field :opened_date, type: Date
|
11
|
+
field :closed_date, type: Date
|
12
|
+
field :case_type, type: String
|
13
|
+
field :case_type_label, type: String
|
14
|
+
field :case_state, type: String
|
15
|
+
field :case_state_label, type: String
|
16
|
+
field :market_sector, type: String
|
17
|
+
field :market_sector_label, type: String
|
18
|
+
field :outcome_type, type: String
|
19
|
+
field :outcome_type_label, type: String
|
20
|
+
field :headers, type: Array
|
16
21
|
|
17
22
|
index "slug", unique: true
|
18
23
|
|
@@ -4,19 +4,46 @@ require "fixtures/specialist_document_fixtures"
|
|
4
4
|
class RenderedSpecialistDocumentTest < ActiveSupport::TestCase
|
5
5
|
include SpecialistDocumentFixtures
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def label_fields
|
8
|
+
{
|
9
|
+
case_type_label: "Some case type",
|
10
|
+
case_state_label: "Open",
|
11
|
+
market_sector_label: "Oil and gas",
|
12
|
+
outcome_type_label: "Referred"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def rendered_specialist_document_attributes
|
17
|
+
basic_specialist_document_fields
|
18
|
+
.reject { |k,v| k == :state }
|
19
|
+
.merge(label_fields)
|
20
|
+
end
|
21
|
+
|
22
|
+
test "can instantiate with basic attributes" do
|
23
|
+
r = RenderedSpecialistDocument.new(rendered_specialist_document_attributes)
|
24
|
+
rendered_specialist_document_attributes.each do |k,v|
|
25
|
+
if (k =~ /date$/)
|
26
|
+
assert_equal Date.parse(v), r.public_send(k.to_sym)
|
27
|
+
else
|
28
|
+
assert_equal v, r.public_send(k.to_sym)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
test "can assign basic attributes" do
|
34
|
+
r = RenderedSpecialistDocument.new
|
35
|
+
rendered_specialist_document_attributes.each do |k,v|
|
36
|
+
r.public_send(:"#{k}=", v)
|
10
37
|
if (k =~ /date$/)
|
11
|
-
assert_equal Date.parse(v), r.
|
38
|
+
assert_equal Date.parse(v), r.public_send(k.to_sym)
|
12
39
|
else
|
13
|
-
assert_equal v, r.
|
40
|
+
assert_equal v, r.public_send(k.to_sym)
|
14
41
|
end
|
15
42
|
end
|
16
43
|
end
|
17
44
|
|
18
45
|
test "can persist" do
|
19
|
-
r = RenderedSpecialistDocument.new(
|
46
|
+
r = RenderedSpecialistDocument.new(rendered_specialist_document_attributes)
|
20
47
|
r.save!
|
21
48
|
|
22
49
|
assert_equal 1, RenderedSpecialistDocument.where(slug: r.slug).count
|
@@ -43,7 +70,7 @@ class RenderedSpecialistDocumentTest < ActiveSupport::TestCase
|
|
43
70
|
"headers" => []
|
44
71
|
}
|
45
72
|
]
|
46
|
-
sample_fields =
|
73
|
+
sample_fields = rendered_specialist_document_attributes.merge(headers: sample_headers)
|
47
74
|
r = RenderedSpecialistDocument.create!(sample_fields)
|
48
75
|
|
49
76
|
found = RenderedSpecialistDocument.where(slug: r.slug).first
|
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: 8.
|
4
|
+
version: 8.9.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-03-
|
12
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -463,7 +463,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
463
463
|
version: '0'
|
464
464
|
segments:
|
465
465
|
- 0
|
466
|
-
hash:
|
466
|
+
hash: 4213322720212660807
|
467
467
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
468
468
|
none: false
|
469
469
|
requirements:
|
@@ -472,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
472
472
|
version: '0'
|
473
473
|
segments:
|
474
474
|
- 0
|
475
|
-
hash:
|
475
|
+
hash: 4213322720212660807
|
476
476
|
requirements: []
|
477
477
|
rubyforge_project:
|
478
478
|
rubygems_version: 1.8.23
|