govuk_content_models 33.0.0 → 34.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/models/artefact.rb +1 -1
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/artefact_tag_test.rb +1 -18
- data/test/models/artefact_test.rb +2 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e57d325ccc96b7ded00251c5fba3ab51e74d58d
|
4
|
+
data.tar.gz: 9bec9ac5c2b93270b66163442d8a771eb21e5398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a34f277be32a2a43a9e6aee4579bf5c66f80614b836db8b3bfcc46a4b7251c01967af251e37cb140c4a77557741cc3bdd945fa22ba777eedb2f9ba352d95b90
|
7
|
+
data.tar.gz: 7cdf7ab729992789532203d469bacd8fd9bb53b66e298446406242067d8c506a55c2117310735961791b55ff3a0afe54f7f109cc5a0afd2f2e3c6493488d8766
|
data/CHANGELOG.md
CHANGED
data/app/models/artefact.rb
CHANGED
@@ -17,7 +17,7 @@ class Artefact
|
|
17
17
|
|
18
18
|
include Taggable
|
19
19
|
stores_tags_for :sections, :writing_teams, :propositions,
|
20
|
-
:keywords, :
|
20
|
+
:keywords, :specialist_sectors, :organisations
|
21
21
|
has_primary_tag_for :section
|
22
22
|
|
23
23
|
field "name", type: String
|
@@ -3,9 +3,6 @@ require "test_helper"
|
|
3
3
|
class ArtefactTagTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
TEST_KEYWORDS = [['cheese', 'Cheese'], ['bacon', 'Bacon']]
|
6
|
-
TEST_LEGACY_SOURCES = [
|
7
|
-
['businesslink', 'Business Link'], ['directgov', 'Directgov'], ['dvla', 'DVLA']
|
8
|
-
]
|
9
6
|
|
10
7
|
setup do
|
11
8
|
parent_section = FactoryGirl.create(:live_tag, :tag_id => 'crime', :tag_type => 'section', :title => 'Crime')
|
@@ -15,9 +12,6 @@ class ArtefactTagTest < ActiveSupport::TestCase
|
|
15
12
|
TEST_KEYWORDS.each do |tag_id, title|
|
16
13
|
FactoryGirl.create(:live_tag, :tag_id => tag_id, :tag_type => 'keyword', :title => title)
|
17
14
|
end
|
18
|
-
TEST_LEGACY_SOURCES.each do |tag_id, title|
|
19
|
-
FactoryGirl.create(:live_tag, :tag_id => tag_id, :tag_type => 'legacy_source', :title => title)
|
20
|
-
end
|
21
15
|
end
|
22
16
|
|
23
17
|
test "return primary section title when asked for its section" do
|
@@ -43,25 +37,14 @@ class ArtefactTagTest < ActiveSupport::TestCase
|
|
43
37
|
a = FactoryGirl.create(:artefact)
|
44
38
|
|
45
39
|
a.sections = ['crime', 'crime/the-police']
|
46
|
-
a.legacy_sources = ['businesslink']
|
47
40
|
a.keywords = ['bacon']
|
48
41
|
|
49
42
|
expected_tags = [
|
50
43
|
{ "tag_id" => "crime", "tag_type" => "section" },
|
51
44
|
{ "tag_id" => "crime/the-police", "tag_type" => "section" },
|
52
|
-
{ "tag_id" => "businesslink", "tag_type" => "legacy_source" },
|
53
45
|
{ "tag_id" => "bacon", "tag_type" => "keyword" },
|
54
46
|
]
|
55
|
-
assert_equal ["crime", "crime/the-police", "
|
47
|
+
assert_equal ["crime", "crime/the-police", "bacon"], a.tag_ids
|
56
48
|
assert_equal expected_tags, a.attributes["tags"]
|
57
49
|
end
|
58
|
-
|
59
|
-
test "has legacy_sources tag collection" do
|
60
|
-
a = FactoryGirl.build(:artefact)
|
61
|
-
a.legacy_sources = ['businesslink', 'dvla']
|
62
|
-
a.save
|
63
|
-
|
64
|
-
a = Artefact.first
|
65
|
-
assert_equal ["businesslink", "dvla"], a.legacy_source_ids
|
66
|
-
end
|
67
50
|
end
|
@@ -551,9 +551,6 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
551
551
|
setup do
|
552
552
|
FactoryGirl.create(:live_tag, :tag_type => 'section', :tag_id => 'crime', :title => 'Crime')
|
553
553
|
FactoryGirl.create(:live_tag, :tag_type => 'section', :tag_id => 'justice', :title => 'Justice', :description => "All about justice")
|
554
|
-
FactoryGirl.create(:live_tag, :tag_type => 'legacy_source', :tag_id => 'directgov', :title => 'Directgov')
|
555
|
-
FactoryGirl.create(:live_tag, :tag_type => 'legacy_source', :tag_id => 'businesslink', :title => 'Business Link')
|
556
|
-
|
557
554
|
@a = FactoryGirl.create(:artefact, :slug => 'fooey')
|
558
555
|
end
|
559
556
|
|
@@ -567,14 +564,13 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
567
564
|
context "for an artefact with tags" do
|
568
565
|
setup do
|
569
566
|
@a.sections = ['justice']
|
570
|
-
@a.legacy_sources = ['businesslink']
|
571
567
|
@a.save!
|
572
568
|
end
|
573
569
|
|
574
570
|
should "return an array of tag_id strings in tag_ids" do
|
575
571
|
hash = @a.as_json
|
576
572
|
|
577
|
-
assert_equal ['justice'
|
573
|
+
assert_equal ['justice'], hash['tag_ids']
|
578
574
|
end
|
579
575
|
|
580
576
|
should "return an array of tag objects in tags" do
|
@@ -588,13 +584,6 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
588
584
|
:description => 'All about justice',
|
589
585
|
:short_description => nil
|
590
586
|
},
|
591
|
-
{
|
592
|
-
:id => 'businesslink',
|
593
|
-
:title => 'Business Link',
|
594
|
-
:type => 'legacy_source',
|
595
|
-
:description => nil,
|
596
|
-
:short_description => nil
|
597
|
-
}
|
598
587
|
]
|
599
588
|
assert_equal expected, hash['tags']
|
600
589
|
end
|
@@ -603,7 +592,7 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
603
592
|
@a.tag_ids << 'batman'
|
604
593
|
hash = @a.as_json
|
605
594
|
|
606
|
-
assert_equal %w(justice
|
595
|
+
assert_equal %w(justice), hash['tags'].map {|t| t[:id] }
|
607
596
|
end
|
608
597
|
end
|
609
598
|
end
|
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: 34.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: 2016-
|
11
|
+
date: 2016-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson_ext
|