govuk_content_models 10.2.1 → 10.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/app/traits/taggable.rb +5 -1
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/traits/taggable_test.rb +12 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/app/traits/taggable.rb
CHANGED
@@ -59,8 +59,12 @@ module Taggable
|
|
59
59
|
# as documented on http://mongoid.org/en/mongoid/docs/documents.html
|
60
60
|
tags
|
61
61
|
|
62
|
+
# Make sure that 'values' is an array. This stops the method blowing up
|
63
|
+
# if nil is provided.
|
64
|
+
values_as_array = Array(values)
|
65
|
+
|
62
66
|
# This will raise a Tag::MissingTags exception unless all the tags exist
|
63
|
-
new_tags = Tag.by_tag_ids!(
|
67
|
+
new_tags = Tag.by_tag_ids!(values_as_array, tag_type)
|
64
68
|
|
65
69
|
@tags.reject! { |t| t.tag_type == tag_type }
|
66
70
|
@tags += new_tags
|
@@ -111,4 +111,16 @@ class TaggableTest < ActiveSupport::TestCase
|
|
111
111
|
|
112
112
|
assert_equal ['bacon'], @item.keyword_ids
|
113
113
|
end
|
114
|
+
|
115
|
+
test "can set tags of type to be nil" do
|
116
|
+
@item.section_ids = nil
|
117
|
+
@item.save!
|
118
|
+
|
119
|
+
assert_equal [], @item.section_ids
|
120
|
+
|
121
|
+
@item.sections = nil
|
122
|
+
@item.save!
|
123
|
+
|
124
|
+
assert_equal [], @item.section_ids
|
125
|
+
end
|
114
126
|
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: 10.2.
|
4
|
+
version: 10.2.2
|
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-04-
|
12
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -465,7 +465,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
465
465
|
version: '0'
|
466
466
|
segments:
|
467
467
|
- 0
|
468
|
-
hash:
|
468
|
+
hash: -333607112453720263
|
469
469
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
470
470
|
none: false
|
471
471
|
requirements:
|
@@ -474,7 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
474
474
|
version: '0'
|
475
475
|
segments:
|
476
476
|
- 0
|
477
|
-
hash:
|
477
|
+
hash: -333607112453720263
|
478
478
|
requirements: []
|
479
479
|
rubyforge_project:
|
480
480
|
rubygems_version: 1.8.23
|