govuk_content_models 17.1.0 → 17.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
+ ## 17.1.1
2
+
3
+ * Make `Artefact#as_json` handle missing tags gracefully
4
+
1
5
  ## 17.1.0
2
6
  * Added `in_beta` field to `Edition`
3
7
 
@@ -213,7 +213,6 @@ class Artefact
213
213
  def as_json(options={})
214
214
  super.tap { |hash|
215
215
  if hash["tag_ids"]
216
- Tag.validate_tag_ids(hash["tag_ids"])
217
216
  hash["tags"] = Tag.by_tag_ids(hash["tag_ids"]).map(&:as_json)
218
217
  else
219
218
  hash["tag_ids"] = []
@@ -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 = "17.1.0"
3
+ VERSION = "17.1.1"
4
4
  end
@@ -552,6 +552,13 @@ class ArtefactTest < ActiveSupport::TestCase
552
552
  ]
553
553
  assert_equal expected, hash['tags']
554
554
  end
555
+
556
+ should "omit non-existent tags referenced from the tag_ids array" do
557
+ @a.tag_ids << 'batman'
558
+ hash = @a.as_json
559
+
560
+ assert_equal %w(justice businesslink), hash['tags'].map {|t| t[:id] }
561
+ end
555
562
  end
556
563
  end
557
564
  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: 17.1.0
4
+ version: 17.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -460,7 +460,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
460
460
  version: '0'
461
461
  segments:
462
462
  - 0
463
- hash: 282022386068419216
463
+ hash: -1314728931253706889
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: 282022386068419216
472
+ hash: -1314728931253706889
473
473
  requirements: []
474
474
  rubyforge_project:
475
475
  rubygems_version: 1.8.23