govuk_content_models 29.1.2 → 30.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 +4 -4
- data/CHANGELOG.md +17 -1
- data/app/models/answer_edition.rb +0 -2
- data/app/models/artefact.rb +7 -12
- data/app/models/business_support_edition.rb +0 -6
- data/app/models/campaign_edition.rb +0 -5
- data/app/models/completed_transaction_edition.rb +0 -3
- data/app/models/edition.rb +34 -38
- data/app/models/guide_edition.rb +0 -1
- data/app/models/help_page_edition.rb +0 -2
- data/app/models/licence_edition.rb +0 -3
- data/app/models/local_transaction_edition.rb +0 -4
- data/app/models/parted.rb +2 -2
- data/app/models/place_edition.rb +0 -2
- data/app/models/programme_edition.rb +0 -1
- data/app/models/simple_smart_answer_edition.rb +7 -6
- data/app/models/transaction_edition.rb +0 -4
- data/app/models/video_edition.rb +0 -2
- data/app/validators/slug_validator.rb +0 -27
- data/lib/govuk_content_models/test_helpers/factories.rb +0 -13
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/artefact_test.rb +0 -9
- data/test/models/edition_test.rb +20 -1
- data/test/models/simple_smart_answer_edition_test.rb +1 -1
- data/test/validators/slug_validator_test.rb +0 -10
- metadata +3 -8
- data/app/models/rendered_specialist_document.rb +0 -19
- data/test/fixtures/specialist_document_fixtures.rb +0 -16
- data/test/models/rendered_specialist_document_test.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace1431a4755075f7fc7d6a9ec4ec9edf0db97cb
|
4
|
+
data.tar.gz: b4744764d54f9a8eff22384617d8c700b4e8caea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1be2224113f915f7df753dd478728911cddd4439a008457b2d99d63da82d28999acae2e4420c6ceee4df3321cef3eb2dcafc29da8fd6887b45ab4c464c814b4a
|
7
|
+
data.tar.gz: a55c774b064aca486549a103d45111ac4a6d581148ec2c6ab30dc77f26129413c4d7b8b4fe7b0768eeac0557b765a2f8bce0a787afba817399edf363e36c2c88
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 30.0.0
|
4
|
+
|
5
|
+
- Add:
|
6
|
+
- `content_id` field to the `Artefact` model
|
7
|
+
|
8
|
+
- Remove:
|
9
|
+
- `specialist_body` field from `Artefact` model
|
10
|
+
- specialist documents from the list of formats owned by `specialist-publisher`
|
11
|
+
- model for rendering `specialist documents`
|
12
|
+
- `specialist document validator` from `slug validator`, its factory and its fixture
|
13
|
+
|
14
|
+
- Include question/answer texts in change notes for SimpleSmartAnswer editions
|
15
|
+
- Stop discarding some fields when creating a new edition (see: https://github.com/alphagov/govuk_content_models/commit/de295d09ea9bdc7397ee2ce1249d12b9cd1d9d66)
|
16
|
+
|
3
17
|
## 29.1.2
|
4
18
|
|
5
|
-
- Bugfix: revert removal of specialist
|
19
|
+
- Bugfix: revert removal of specialist document code since it breaks Panopticon integration
|
6
20
|
|
7
21
|
## 29.1.1
|
8
22
|
|
@@ -11,6 +25,7 @@
|
|
11
25
|
## 29.1.0
|
12
26
|
|
13
27
|
- Allow detailed guide slugs to start with /guidance
|
28
|
+
- Remove code relating to specialist documents
|
14
29
|
|
15
30
|
## 29.0.1
|
16
31
|
|
@@ -42,6 +57,7 @@
|
|
42
57
|
|
43
58
|
- Change the scheduled publishing timestamp to be London local time
|
44
59
|
instead of UTC.
|
60
|
+
|
45
61
|
## 28.7.0
|
46
62
|
|
47
63
|
- Add `vehicle_recalls_and_faults_alert` artefact format
|
data/app/models/artefact.rb
CHANGED
@@ -37,13 +37,18 @@ class Artefact
|
|
37
37
|
field "publication_id", type: String
|
38
38
|
field "description", type: String
|
39
39
|
field "state", type: String, default: "draft"
|
40
|
-
field "specialist_body", type: String
|
41
40
|
field "language", type: String, default: "en"
|
42
41
|
field "need_extended_font", type: Boolean, default: false
|
43
42
|
field "latest_change_note", type: String
|
44
43
|
field "public_timestamp", type: DateTime
|
45
44
|
field "redirect_url", type: String
|
46
45
|
|
46
|
+
# content_id should be unique but we have existing artefacts without it.
|
47
|
+
# We should therefore enforce the uniqueness as soon as:
|
48
|
+
# - every current artefact will have a content id assigned
|
49
|
+
# - every future artefact will be created with a content id
|
50
|
+
field "content_id", type: String
|
51
|
+
|
47
52
|
index "slug", :unique => true
|
48
53
|
|
49
54
|
# This index allows the `relatable_artefacts` method to use an index-covered
|
@@ -75,17 +80,7 @@ class Artefact
|
|
75
80
|
"smartanswers" => ["smart-answer"],
|
76
81
|
"custom-application" => ["custom-application"], # In this case the owning_app is overriden. eg calendars, licencefinder
|
77
82
|
"travel-advice-publisher" => ["travel-advice"],
|
78
|
-
"specialist-publisher" => ["
|
79
|
-
"cma_case",
|
80
|
-
"countryside_stewardship_grant",
|
81
|
-
"drug_safety_update",
|
82
|
-
"european_structural_investment_fund",
|
83
|
-
"international_development_fund",
|
84
|
-
"maib_report",
|
85
|
-
"manual",
|
86
|
-
"medical_safety_alert",
|
87
|
-
"raib_report",
|
88
|
-
"vehicle_recalls_and_faults_alert"],
|
83
|
+
"specialist-publisher" => ["manual"],
|
89
84
|
"finder-api" => ["finder",
|
90
85
|
"finder_email_signup"],
|
91
86
|
"whitehall" => ["announcement",
|
@@ -39,12 +39,6 @@ class BusinessSupportEdition < Edition
|
|
39
39
|
# https://github.com/mongoid/mongoid/issues/1735 Really Mongoid‽
|
40
40
|
validates :min_value, :max_value, :max_employees, :numericality => {:allow_nil => true, :only_integer => true}
|
41
41
|
|
42
|
-
@fields_to_clone = [:body, :min_value, :max_value, :max_employees, :organiser,
|
43
|
-
:eligibility, :evaluation, :additional_information, :continuation_link,
|
44
|
-
:will_continue_on, :contact_details, :short_description, :priority, :areas,
|
45
|
-
:business_sizes, :locations, :purposes, :sectors, :stages, :support_types,
|
46
|
-
:start_date, :end_date]
|
47
|
-
|
48
42
|
scope :for_facets, lambda { |facets|
|
49
43
|
where({ "$and" => facets_criteria(facets) }).order_by([:priority, :desc], [:title, :asc])
|
50
44
|
}
|
@@ -14,11 +14,6 @@ class CampaignEdition < Edition
|
|
14
14
|
|
15
15
|
GOVSPEAK_FIELDS = [:body]
|
16
16
|
|
17
|
-
@fields_to_clone = [
|
18
|
-
:body, :large_image_id, :medium_image_id, :small_image_id,
|
19
|
-
:organisation_formatted_name, :organisation_url, :organisation_brand_colour, :organisation_crest
|
20
|
-
]
|
21
|
-
|
22
17
|
BRAND_COLOURS = [
|
23
18
|
"attorney-generals-office",
|
24
19
|
"cabinet-office",
|
data/app/models/edition.rb
CHANGED
@@ -66,9 +66,6 @@ class Edition
|
|
66
66
|
index "created_at"
|
67
67
|
index "updated_at"
|
68
68
|
|
69
|
-
class << self; attr_accessor :fields_to_clone end
|
70
|
-
@fields_to_clone = []
|
71
|
-
|
72
69
|
alias_method :admin_list_title, :title
|
73
70
|
|
74
71
|
def series
|
@@ -173,24 +170,9 @@ class Edition
|
|
173
170
|
# If the new clone is of the same type, we can copy all its fields over; if
|
174
171
|
# we are changing the type of the edition, any fields other than the base
|
175
172
|
# fields will likely be meaningless.
|
176
|
-
def fields_to_copy(
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
def build_clone(edition_class=nil)
|
181
|
-
unless state == "published"
|
182
|
-
raise "Cloning of non published edition not allowed"
|
183
|
-
end
|
184
|
-
unless can_create_new_edition?
|
185
|
-
raise "Cloning of a published edition when an in-progress edition exists
|
186
|
-
is not allowed"
|
187
|
-
end
|
188
|
-
|
189
|
-
edition_class = self.class unless edition_class
|
190
|
-
new_edition = edition_class.new(title: self.title,
|
191
|
-
version_number: get_next_version_number)
|
192
|
-
|
193
|
-
real_fields_to_merge = fields_to_copy(edition_class) + [
|
173
|
+
def fields_to_copy(target_class)
|
174
|
+
return_value = [
|
175
|
+
:title,
|
194
176
|
:panopticon_id,
|
195
177
|
:overview,
|
196
178
|
:slug,
|
@@ -198,31 +180,45 @@ class Edition
|
|
198
180
|
:primary_topic,
|
199
181
|
:additional_topics
|
200
182
|
]
|
201
|
-
|
202
|
-
|
203
|
-
|
183
|
+
if target_class == self.class
|
184
|
+
type_specific_keys = self.fields.keys - Edition.fields.keys
|
185
|
+
return_value += type_specific_keys
|
204
186
|
end
|
187
|
+
return_value
|
188
|
+
end
|
205
189
|
|
206
|
-
|
207
|
-
|
190
|
+
def build_clone(target_class=nil)
|
191
|
+
unless state == "published"
|
192
|
+
raise "Cloning of non published edition not allowed"
|
208
193
|
end
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
new_edition.overview = licence_overview
|
194
|
+
unless can_create_new_edition?
|
195
|
+
raise "Cloning of a published edition when an in-progress edition exists
|
196
|
+
is not allowed"
|
213
197
|
end
|
214
198
|
|
215
|
-
|
216
|
-
|
217
|
-
end
|
199
|
+
target_class = self.class unless target_class
|
200
|
+
new_edition = target_class.new(version_number: get_next_version_number)
|
218
201
|
|
219
|
-
|
220
|
-
new_edition
|
202
|
+
fields_to_copy(target_class).each do |attr|
|
203
|
+
new_edition[attr] = read_attribute(attr)
|
221
204
|
end
|
222
205
|
|
223
|
-
|
224
|
-
|
225
|
-
|
206
|
+
# If the type is changing, then take the combined body (whole_body) from
|
207
|
+
# the old and decide where to put it in the new.
|
208
|
+
#
|
209
|
+
# Where the type is not changing, the body will already have been copied
|
210
|
+
# above.
|
211
|
+
#
|
212
|
+
# We don't need to copy parts between Parted types here, because the Parted
|
213
|
+
# module does that.
|
214
|
+
if target_class != self.class
|
215
|
+
if new_edition.respond_to?(:parts) and !self.respond_to?(:parts)
|
216
|
+
new_edition.parts.build(title: "Part One", body: whole_body, slug: "part-one")
|
217
|
+
elsif new_edition.respond_to?(:more_information=)
|
218
|
+
new_edition.more_information = whole_body
|
219
|
+
elsif new_edition.respond_to?(:body=)
|
220
|
+
new_edition.body = whole_body
|
221
|
+
end
|
226
222
|
end
|
227
223
|
|
228
224
|
new_edition
|
data/app/models/guide_edition.rb
CHANGED
@@ -14,9 +14,6 @@ class LicenceEdition < Edition
|
|
14
14
|
validate :licence_identifier_unique
|
15
15
|
validates_format_of :continuation_link, :with => URI::regexp(%w(http https)), :allow_blank => true
|
16
16
|
|
17
|
-
@fields_to_clone = [:licence_identifier, :licence_short_description,
|
18
|
-
:licence_overview, :will_continue_on, :continuation_link]
|
19
|
-
|
20
17
|
def whole_body
|
21
18
|
[licence_short_description, licence_overview].join("\n\n")
|
22
19
|
end
|
@@ -10,10 +10,6 @@ class LocalTransactionEdition < Edition
|
|
10
10
|
|
11
11
|
GOVSPEAK_FIELDS = [:introduction, :more_information, :need_to_know]
|
12
12
|
|
13
|
-
@fields_to_clone = [
|
14
|
-
:lgsl_code, :introduction, :more_information, :need_to_know
|
15
|
-
]
|
16
|
-
|
17
13
|
validate :valid_lgsl_code
|
18
14
|
|
19
15
|
def valid_lgsl_code
|
data/app/models/parted.rb
CHANGED
@@ -8,12 +8,12 @@ module Parted
|
|
8
8
|
klass.after_validation :merge_embedded_parts_errors
|
9
9
|
end
|
10
10
|
|
11
|
-
def build_clone(
|
11
|
+
def build_clone(target_class=nil)
|
12
12
|
new_edition = super
|
13
13
|
|
14
14
|
# If the new edition is of the same type or another type that has parts,
|
15
15
|
# copy over the parts from this edition
|
16
|
-
if
|
16
|
+
if target_class.nil? or target_class.include? Parted
|
17
17
|
new_edition.parts = self.parts.map {|p| p.dup }
|
18
18
|
end
|
19
19
|
|
data/app/models/place_edition.rb
CHANGED
@@ -13,15 +13,16 @@ class SimpleSmartAnswerEdition < Edition
|
|
13
13
|
|
14
14
|
GOVSPEAK_FIELDS = [:body]
|
15
15
|
|
16
|
-
@fields_to_clone = [:body]
|
17
|
-
|
18
16
|
def whole_body
|
19
|
-
body
|
17
|
+
parts = [body]
|
18
|
+
unless nodes.nil?
|
19
|
+
parts += nodes.map { |node| "#{node.kind}: #{node.title} \n\n #{node.body}" }
|
20
|
+
end
|
21
|
+
parts.join("\n\n\n")
|
20
22
|
end
|
21
23
|
|
22
|
-
def build_clone(
|
23
|
-
new_edition = super(
|
24
|
-
new_edition.body = self.body
|
24
|
+
def build_clone(target_class=nil)
|
25
|
+
new_edition = super(target_class)
|
25
26
|
|
26
27
|
if new_edition.is_a?(SimpleSmartAnswerEdition)
|
27
28
|
self.nodes.each {|n| new_edition.nodes << n.clone }
|
@@ -13,10 +13,6 @@ class TransactionEdition < Edition
|
|
13
13
|
|
14
14
|
validates_format_of :department_analytics_profile, with: /UA-\d+-\d+/i, allow_blank: true
|
15
15
|
|
16
|
-
@fields_to_clone = [:introduction, :will_continue_on, :link,
|
17
|
-
:more_information, :alternate_methods,
|
18
|
-
:need_to_know, :department_analytics_profile]
|
19
|
-
|
20
16
|
def indexable_content
|
21
17
|
"#{super} #{Govspeak::Document.new(introduction).to_text} #{Govspeak::Document.new(more_information).to_text}".strip
|
22
18
|
end
|
data/app/models/video_edition.rb
CHANGED
@@ -8,7 +8,6 @@ class SlugValidator < ActiveModel::EachValidator
|
|
8
8
|
FinderEmailSignupValidator,
|
9
9
|
GovernmentPageValidator,
|
10
10
|
ManualPageValidator,
|
11
|
-
SpecialistDocumentPageValidator,
|
12
11
|
BrowsePageValidator,
|
13
12
|
DetailedGuideValidator,
|
14
13
|
DefaultValidator
|
@@ -148,32 +147,6 @@ protected
|
|
148
147
|
end
|
149
148
|
end
|
150
149
|
|
151
|
-
class SpecialistDocumentPageValidator < InstanceValidator
|
152
|
-
def applicable?
|
153
|
-
of_kind?(acceptable_formats)
|
154
|
-
end
|
155
|
-
|
156
|
-
def validate!
|
157
|
-
unless url_parts.size == 2
|
158
|
-
record.errors[attribute] << "must be of form <finder-slug>/<specialist-document-slug>"
|
159
|
-
end
|
160
|
-
unless url_parts.all? { |url_part| valid_slug?(url_part) }
|
161
|
-
record.errors[attribute] << "must be usable in a URL"
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
private
|
166
|
-
def acceptable_formats
|
167
|
-
Artefact::FORMATS_BY_DEFAULT_OWNING_APP["specialist-publisher"] - unacceptable_formats
|
168
|
-
end
|
169
|
-
|
170
|
-
def unacceptable_formats
|
171
|
-
[
|
172
|
-
"manual",
|
173
|
-
]
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
150
|
class BrowsePageValidator < InstanceValidator
|
178
151
|
def applicable?
|
179
152
|
of_kind?('specialist_sector')
|
@@ -252,19 +252,6 @@ FactoryGirl.define do
|
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
-
factory :rendered_specialist_document do
|
256
|
-
sequence(:slug) {|n| "test-rendered-specialist-document-#{n}" }
|
257
|
-
sequence(:title) {|n| "Test Rendered Specialist Document #{n}" }
|
258
|
-
summary "My summary"
|
259
|
-
body "<p>My body</p>"
|
260
|
-
details({
|
261
|
-
"opened_date" => "2013-04-20",
|
262
|
-
"market_sector" => "some-market-sector",
|
263
|
-
"case_type" => "a-case-type",
|
264
|
-
"case_state" => "open",
|
265
|
-
})
|
266
|
-
end
|
267
|
-
|
268
255
|
factory :rendered_manual do
|
269
256
|
sequence(:slug) {|n| "test-rendered-manual-#{n}" }
|
270
257
|
sequence(:title) {|n| "Test Rendered Manual #{n}" }
|
@@ -424,15 +424,6 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
424
424
|
assert artefact.any_editions_published?
|
425
425
|
end
|
426
426
|
|
427
|
-
test "should have a specialist_body field present for markdown content" do
|
428
|
-
artefact = Artefact.create!(slug: "parent", name: "Harry Potter", kind: "guide", owning_app: "x")
|
429
|
-
refute_includes artefact.attributes, "specialist_body"
|
430
|
-
|
431
|
-
artefact.specialist_body = "Something wicked this way comes"
|
432
|
-
assert_includes artefact.attributes, "specialist_body"
|
433
|
-
assert_equal "Something wicked this way comes", artefact.specialist_body
|
434
|
-
end
|
435
|
-
|
436
427
|
test "should have 'video' as a supported FORMAT" do
|
437
428
|
assert_includes Artefact::FORMATS, "video"
|
438
429
|
end
|
data/test/models/edition_test.rb
CHANGED
@@ -235,7 +235,8 @@ class EditionTest < ActiveSupport::TestCase
|
|
235
235
|
assert_equal 2, new_edition.version_number
|
236
236
|
assert_equal @artefact.id.to_s, new_edition.panopticon_id
|
237
237
|
assert_equal "draft", new_edition.state
|
238
|
-
|
238
|
+
assert_match /#{edition.licence_overview}/, new_edition.body
|
239
|
+
assert_match /#{edition.licence_short_description}/, new_edition.body
|
239
240
|
assert_equal edition.whole_body, new_edition.body
|
240
241
|
end
|
241
242
|
|
@@ -277,6 +278,24 @@ class EditionTest < ActiveSupport::TestCase
|
|
277
278
|
assert_equal edition.whole_body, new_edition.whole_body
|
278
279
|
end
|
279
280
|
|
281
|
+
test "Cloning from SimpleSmartAnswerEdition into AnswerEdition" do
|
282
|
+
edition = FactoryGirl.create(
|
283
|
+
:simple_smart_answer_edition,
|
284
|
+
state: "published",
|
285
|
+
panopticon_id: @artefact.id,
|
286
|
+
version_number: 1,
|
287
|
+
overview: "I am a test overview",
|
288
|
+
)
|
289
|
+
new_edition = edition.build_clone AnswerEdition
|
290
|
+
|
291
|
+
assert_equal AnswerEdition, new_edition.class
|
292
|
+
assert_equal 2, new_edition.version_number
|
293
|
+
assert_equal @artefact.id.to_s, new_edition.panopticon_id
|
294
|
+
assert_equal "draft", new_edition.state
|
295
|
+
assert_equal "I am a test overview", new_edition.overview
|
296
|
+
assert_equal edition.whole_body, new_edition.whole_body
|
297
|
+
end
|
298
|
+
|
280
299
|
test "Cloning from AnswerEdition into TransactionEdition" do
|
281
300
|
edition = FactoryGirl.create(
|
282
301
|
:answer_edition,
|
@@ -56,7 +56,7 @@ class SimpleSmartAnswerEditionTest < ActiveSupport::TestCase
|
|
56
56
|
|
57
57
|
new_edition = edition.build_clone(AnswerEdition)
|
58
58
|
|
59
|
-
assert_equal
|
59
|
+
assert_equal "This smart answer is somewhat unique and calls for a different kind of introduction\n\n\nquestion: You approach two open doors. Which do you choose? \n\n ", new_edition.body
|
60
60
|
|
61
61
|
assert new_edition.is_a?(AnswerEdition)
|
62
62
|
assert ! new_edition.respond_to?(:nodes)
|
@@ -76,16 +76,6 @@ class SlugTest < ActiveSupport::TestCase
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
context "Specialist documents" do
|
80
|
-
should "all url nested one level deep" do
|
81
|
-
assert document_with_slug("some-finder/my-specialist-document", kind: "cma_case").valid?;
|
82
|
-
end
|
83
|
-
|
84
|
-
should "not allow deeper nesting" do
|
85
|
-
refute document_with_slug("some-finder/my-specialist-document/not-allowed", kind: "cma_case").valid?
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
79
|
context "Specialist sector browse pages" do
|
90
80
|
should "allow a single path part" do
|
91
81
|
assert document_with_slug("oil-and-gas", kind: "specialist_sector").valid?
|
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:
|
4
|
+
version: 30.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-
|
11
|
+
date: 2015-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson_ext
|
@@ -310,7 +310,6 @@ files:
|
|
310
310
|
- app/models/prerendered_entity.rb
|
311
311
|
- app/models/programme_edition.rb
|
312
312
|
- app/models/rendered_manual.rb
|
313
|
-
- app/models/rendered_specialist_document.rb
|
314
313
|
- app/models/simple_smart_answer_edition.rb
|
315
314
|
- app/models/simple_smart_answer_edition/node.rb
|
316
315
|
- app/models/simple_smart_answer_edition/node/option.rb
|
@@ -360,7 +359,6 @@ files:
|
|
360
359
|
- lib/govuk_content_models/version.rb
|
361
360
|
- lib/mongoid/monkey_patches.rb
|
362
361
|
- test/fixtures/contactotron_api_response.json
|
363
|
-
- test/fixtures/specialist_document_fixtures.rb
|
364
362
|
- test/fixtures/uploads/image.jpg
|
365
363
|
- test/models/action_test.rb
|
366
364
|
- test/models/artefact_action_test.rb
|
@@ -390,7 +388,6 @@ files:
|
|
390
388
|
- test/models/parted_test.rb
|
391
389
|
- test/models/prerendered_entity_tests.rb
|
392
390
|
- test/models/rendered_manual_test.rb
|
393
|
-
- test/models/rendered_specialist_document_test.rb
|
394
391
|
- test/models/simple_smart_answer_edition_test.rb
|
395
392
|
- test/models/simple_smart_answer_node_test.rb
|
396
393
|
- test/models/simple_smart_answer_option_test.rb
|
@@ -430,13 +427,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
430
427
|
version: '0'
|
431
428
|
requirements: []
|
432
429
|
rubyforge_project:
|
433
|
-
rubygems_version: 2.2.
|
430
|
+
rubygems_version: 2.2.5
|
434
431
|
signing_key:
|
435
432
|
specification_version: 4
|
436
433
|
summary: Shared models for Panopticon and Publisher, as a Rails Engine
|
437
434
|
test_files:
|
438
435
|
- test/fixtures/contactotron_api_response.json
|
439
|
-
- test/fixtures/specialist_document_fixtures.rb
|
440
436
|
- test/fixtures/uploads/image.jpg
|
441
437
|
- test/models/action_test.rb
|
442
438
|
- test/models/artefact_action_test.rb
|
@@ -466,7 +462,6 @@ test_files:
|
|
466
462
|
- test/models/parted_test.rb
|
467
463
|
- test/models/prerendered_entity_tests.rb
|
468
464
|
- test/models/rendered_manual_test.rb
|
469
|
-
- test/models/rendered_specialist_document_test.rb
|
470
465
|
- test/models/simple_smart_answer_edition_test.rb
|
471
466
|
- test/models/simple_smart_answer_node_test.rb
|
472
467
|
- test/models/simple_smart_answer_option_test.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "prerendered_entity"
|
2
|
-
|
3
|
-
class RenderedSpecialistDocument
|
4
|
-
include Mongoid::Document
|
5
|
-
include Mongoid::Timestamps
|
6
|
-
extend PrerenderedEntity
|
7
|
-
|
8
|
-
field :slug, type: String
|
9
|
-
field :title, type: String
|
10
|
-
field :summary, type: String
|
11
|
-
field :body, type: String
|
12
|
-
field :published_at, type: DateTime
|
13
|
-
|
14
|
-
field :details, type: Hash
|
15
|
-
|
16
|
-
index "slug", unique: true
|
17
|
-
|
18
|
-
validates :slug, uniqueness: true
|
19
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module SpecialistDocumentFixtures
|
2
|
-
def basic_specialist_document_fields
|
3
|
-
{
|
4
|
-
slug: 'cma-cases/merger-investigation-2014',
|
5
|
-
title: "Merger Investigation 2014",
|
6
|
-
summary: "This is the summary of stuff going on in the Merger Investigation 2014",
|
7
|
-
state: "published",
|
8
|
-
body: "A body",
|
9
|
-
opened_date: '2012-04-21',
|
10
|
-
document_id: 'a-document-id',
|
11
|
-
market_sector: 'oil-and-gas',
|
12
|
-
case_type: 'some-case-type',
|
13
|
-
case_state: 'open'
|
14
|
-
}
|
15
|
-
end
|
16
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
require "fixtures/specialist_document_fixtures"
|
3
|
-
require "models/prerendered_entity_tests"
|
4
|
-
|
5
|
-
class RenderedSpecialistDocumentTest < ActiveSupport::TestCase
|
6
|
-
include SpecialistDocumentFixtures
|
7
|
-
include PrerenderedEntityTests
|
8
|
-
|
9
|
-
def model_class
|
10
|
-
RenderedSpecialistDocument
|
11
|
-
end
|
12
|
-
end
|