govuk_content_models 19.0.0 → 20.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.
- data/CHANGELOG.md +4 -0
- data/app/models/edition.rb +1 -3
- data/app/models/workflow.rb +1 -1
- data/lib/govuk_content_models/test_helpers/factories.rb +0 -2
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/artefact_test.rb +0 -1
- data/test/models/edition_scheduled_for_publishing_test.rb +0 -9
- data/test/models/edition_test.rb +0 -7
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 20.0.0
|
2
|
+
|
3
|
+
* Breaking change: Remove `section` field on `Edition`. This reduces coupling between Panopticon and Publisher apps. Section should be inferred from the edition's artefact instead.
|
4
|
+
|
1
5
|
## 19.0.0
|
2
6
|
|
3
7
|
* BREAKING CHANGE: String fields can no longer include arbitrary images. They
|
data/app/models/edition.rb
CHANGED
@@ -17,7 +17,6 @@ class Edition
|
|
17
17
|
field :overview, type: String
|
18
18
|
field :alternative_title, type: String
|
19
19
|
field :slug, type: String
|
20
|
-
field :section, type: String
|
21
20
|
field :department, type: String
|
22
21
|
field :rejected_count, type: Integer, default: 0
|
23
22
|
field :tags, type: String
|
@@ -154,7 +153,7 @@ class Edition
|
|
154
153
|
|
155
154
|
real_fields_to_merge = fields_to_copy(edition_class) +
|
156
155
|
[:panopticon_id, :overview, :alternative_title,
|
157
|
-
:slug, :
|
156
|
+
:slug, :department]
|
158
157
|
|
159
158
|
real_fields_to_merge.each do |attr|
|
160
159
|
new_edition[attr] = read_attribute(attr)
|
@@ -188,7 +187,6 @@ class Edition
|
|
188
187
|
panopticon_id: metadata.id,
|
189
188
|
slug: metadata.slug,
|
190
189
|
title: metadata.name,
|
191
|
-
section: metadata.section,
|
192
190
|
department: metadata.department,
|
193
191
|
business_proposition: metadata.business_proposition)
|
194
192
|
end
|
data/app/models/workflow.rb
CHANGED
@@ -244,7 +244,7 @@ module Workflow
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def disallowable_change?
|
247
|
-
allowed_to_change = %w(slug
|
247
|
+
allowed_to_change = %w(slug publish_at department business_proposition)
|
248
248
|
(changes.keys - allowed_to_change).present?
|
249
249
|
end
|
250
250
|
end
|
@@ -89,8 +89,6 @@ FactoryGirl.define do
|
|
89
89
|
sequence(:slug) { |n| "slug-#{n}" }
|
90
90
|
sequence(:title) { |n| "A key answer to your question #{n}" }
|
91
91
|
|
92
|
-
section "test:subsection test"
|
93
|
-
|
94
92
|
after :build do |ed|
|
95
93
|
if previous = ed.series.order(version_number: "desc").first
|
96
94
|
ed.version_number = previous.version_number + 1
|
@@ -53,15 +53,6 @@ class EditionScheduledForPublishingTest < ActiveSupport::TestCase
|
|
53
53
|
assert_includes edition.errors.full_messages, "Editions scheduled for publishing can't be edited"
|
54
54
|
end
|
55
55
|
|
56
|
-
should "allow editing fields like section" do
|
57
|
-
edition = FactoryGirl.create(:edition, :scheduled_for_publishing)
|
58
|
-
|
59
|
-
edition.section = 'new section'
|
60
|
-
|
61
|
-
assert edition.save
|
62
|
-
assert_equal edition.reload.section, 'new section'
|
63
|
-
end
|
64
|
-
|
65
56
|
should "return false for #can_destroy?" do
|
66
57
|
edition = FactoryGirl.build(:edition, :scheduled_for_publishing)
|
67
58
|
refute edition.can_destroy?
|
data/test/models/edition_test.rb
CHANGED
@@ -118,7 +118,6 @@ class EditionTest < ActiveSupport::TestCase
|
|
118
118
|
alternative_title: "Alternative test title")
|
119
119
|
clone_edition = edition.build_clone
|
120
120
|
assert_equal clone_edition.department, "Test dept"
|
121
|
-
assert_equal clone_edition.section, "test:subsection test"
|
122
121
|
assert_equal clone_edition.overview, "I am a test overview"
|
123
122
|
assert_equal clone_edition.alternative_title, "Alternative test title"
|
124
123
|
assert_equal clone_edition.version_number, 2
|
@@ -374,7 +373,6 @@ class EditionTest < ActiveSupport::TestCase
|
|
374
373
|
end
|
375
374
|
|
376
375
|
test "should create a publication based on data imported from panopticon" do
|
377
|
-
section = FactoryGirl.create(:live_tag, tag_id: "test-section", title: "Test section", tag_type: "section")
|
378
376
|
artefact = FactoryGirl.create(:artefact,
|
379
377
|
slug: "foo-bar",
|
380
378
|
kind: "answer",
|
@@ -382,13 +380,9 @@ class EditionTest < ActiveSupport::TestCase
|
|
382
380
|
department: "Test dept",
|
383
381
|
owning_app: "publisher",
|
384
382
|
)
|
385
|
-
artefact.primary_section = section.tag_id
|
386
383
|
artefact.save!
|
387
384
|
|
388
385
|
a = Artefact.find(artefact.id)
|
389
|
-
|
390
|
-
assert_equal section.tag_id, artefact.primary_section.tag_id
|
391
|
-
assert_equal section.title, artefact.primary_section.title
|
392
386
|
user = User.create
|
393
387
|
|
394
388
|
publication = Edition.find_or_create_from_panopticon_data(artefact.id, user, {})
|
@@ -396,7 +390,6 @@ class EditionTest < ActiveSupport::TestCase
|
|
396
390
|
assert_kind_of AnswerEdition, publication
|
397
391
|
assert_equal artefact.name, publication.title
|
398
392
|
assert_equal artefact.id.to_s, publication.panopticon_id.to_s
|
399
|
-
assert_equal section.title, publication.section
|
400
393
|
assert_equal artefact.department, publication.department
|
401
394
|
end
|
402
395
|
|
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:
|
4
|
+
version: 20.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-08-
|
12
|
+
date: 2014-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -460,7 +460,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
460
460
|
version: '0'
|
461
461
|
segments:
|
462
462
|
- 0
|
463
|
-
hash:
|
463
|
+
hash: 2827572676996359108
|
464
464
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
465
465
|
none: false
|
466
466
|
requirements:
|
@@ -469,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
469
469
|
version: '0'
|
470
470
|
segments:
|
471
471
|
- 0
|
472
|
-
hash:
|
472
|
+
hash: 2827572676996359108
|
473
473
|
requirements: []
|
474
474
|
rubyforge_project:
|
475
475
|
rubygems_version: 1.8.23
|