govuk_content_models 22.1.0 → 22.1.1

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 22.1.1
2
+
3
+ * Copy collection associations when cloning Editions
4
+
1
5
  ## 22.1.0
2
6
 
3
7
  * Add default values for collection associations on Edition
@@ -155,9 +155,16 @@ class Edition
155
155
  new_edition = edition_class.new(title: self.title,
156
156
  version_number: get_next_version_number)
157
157
 
158
- real_fields_to_merge = fields_to_copy(edition_class) +
159
- [:panopticon_id, :overview, :alternative_title,
160
- :slug, :department]
158
+ real_fields_to_merge = fields_to_copy(edition_class) + [
159
+ :panopticon_id,
160
+ :overview,
161
+ :alternative_title,
162
+ :slug,
163
+ :department,
164
+ :browse_pages,
165
+ :primary_topic,
166
+ :additional_topics
167
+ ]
161
168
 
162
169
  real_fields_to_merge.each do |attr|
163
170
  new_edition[attr] = read_attribute(attr)
@@ -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 = "22.1.0"
3
+ VERSION = "22.1.1"
4
4
  end
@@ -1074,5 +1074,26 @@ class EditionTest < ActiveSupport::TestCase
1074
1074
  should "validates browse pages" do
1075
1075
  assert_includes Edition.validators.map(&:class), BrowsePageValidator
1076
1076
  end
1077
+
1078
+ should "retain collections across new editions" do
1079
+ edition = FactoryGirl.create(:guide_edition,
1080
+ panopticon_id: @artefact.id,
1081
+ state: "published",
1082
+ primary_topic: 'oil-and-gas/carbon-capture-and-storage',
1083
+ additional_topics: [
1084
+ 'oil-and-gas/fields-and-wells',
1085
+ 'oil-and-gas/licensing'
1086
+ ],
1087
+ browse_pages: [
1088
+ 'education/school-admissions-transport',
1089
+ 'driving/drivers-lorries-buses'
1090
+ ]
1091
+ )
1092
+
1093
+ new_edition = edition.build_clone
1094
+ assert_equal edition.primary_topic, new_edition.primary_topic
1095
+ assert_equal edition.additional_topics, new_edition.additional_topics
1096
+ assert_equal edition.browse_pages, new_edition.browse_pages
1097
+ end
1077
1098
  end
1078
1099
  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: 22.1.0
4
+ version: 22.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -464,7 +464,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
464
464
  version: '0'
465
465
  segments:
466
466
  - 0
467
- hash: -3250701866585656813
467
+ hash: 510366184885881008
468
468
  required_rubygems_version: !ruby/object:Gem::Requirement
469
469
  none: false
470
470
  requirements:
@@ -473,7 +473,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
473
  version: '0'
474
474
  segments:
475
475
  - 0
476
- hash: -3250701866585656813
476
+ hash: 510366184885881008
477
477
  requirements: []
478
478
  rubyforge_project:
479
479
  rubygems_version: 1.8.23