semantically-taggable 0.2.2 → 0.3.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/spec/models.rb CHANGED
@@ -4,6 +4,10 @@ class Article < ActiveRecord::Base
4
4
  has_many :untaggable_models
5
5
  end
6
6
 
7
+ class Contact < ActiveRecord::Base
8
+ semantically_taggable :dg_topics
9
+ end
10
+
7
11
  class CachedModel < ActiveRecord::Base
8
12
  semantically_taggable :keywords
9
13
  end
data/spec/schema.rb CHANGED
@@ -62,6 +62,10 @@ ActiveRecord::Schema.define :version => 0 do
62
62
  t.column :name, :string
63
63
  t.column :type, :string
64
64
  end
65
+
66
+ create_table :contacts, :force => true do |t|
67
+ t.column :contact_point, :string
68
+ end
65
69
 
66
70
  create_table :untaggable_models, :force => true do |t|
67
71
  t.column :article_id, :integer
@@ -31,26 +31,28 @@ describe SemanticallyTaggable::TagParentage do
31
31
  describe "Getting indirectly tagged articles" do
32
32
  before :all do
33
33
  @nhs_article = Article.create(:name => 'NHS Direct article', :dg_topic_list => 'NHS Direct')
34
- @jobs_article = Article.create(:name => 'Jobs article', :dg_topic_list => 'Job Grants')
34
+ @generic_health_article = Article.create(:name => 'Health article', :dg_topic_list => 'Health and care')
35
+ @jobs_article = Article.create(:name => 'Jobs article', :dg_topic_list => ['Job Grants', 'Directgov Taxonomy'])
36
+
37
+ @generic_health_contact = Contact.create(:contact_point => 'Health contact', :dg_topic_list => 'Health and care')
35
38
  end
36
39
 
37
40
  it "should get articles tagged_with 'Health and care' when they're tagged with a sub-tag" do
38
- Article.tagged_with('Health and care', :on => :dg_topics).should have(1).article
41
+ Article.tagged_with('Health and care', :on => :dg_topics).should have(2).articles
39
42
  end
40
43
 
41
-
42
44
  it "should get all articles for the taxonomy" do
43
- Article.tagged_with('Directgov taxonomy', :on => :dg_topics).should have(2).articles
45
+ Article.tagged_with('Directgov taxonomy', :on => :dg_topics).uniq.should have(3).articles
44
46
  end
45
47
 
46
48
  describe "The :any option" do
47
49
  subject { Article.tagged_with('Health and care', :on => :dg_topics, :any => true) }
48
50
 
49
- it { should have(1).article }
51
+ it { should have(2).articles }
50
52
  its(:first) { should eql(@nhs_article) }
51
53
  specify do
52
54
  Article.tagged_with(['Health and care', 'Job Grants'], :on => :dg_topics, :any => true).
53
- should have(2).articles
55
+ should have(3).articles
54
56
  end
55
57
  end
56
58
 
@@ -60,6 +62,12 @@ describe SemanticallyTaggable::TagParentage do
60
62
  its(:length) { should eql(1) }
61
63
  its(:first) { should eql(@jobs_article) }
62
64
  end
65
+
66
+ describe "Tag counts for a schemed tag" do
67
+ subject { SemanticallyTaggable::Tag.named('Directgov Taxonomy').first.model_counts }
68
+
69
+ it { should eql({ 'Article' => 3, 'Contact' => 1 }) }
70
+ end
63
71
  end
64
72
  end
65
73
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantically-taggable
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 2
9
- version: 0.2.2
4
+ prerelease:
5
+ version: 0.3.1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Russell Garner
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-07-05 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-07-06 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rails
@@ -24,9 +19,6 @@ dependencies:
24
19
  requirements:
25
20
  - - ">="
26
21
  - !ruby/object:Gem::Version
27
- segments:
28
- - 3
29
- - 0
30
22
  version: "3.0"
31
23
  type: :runtime
32
24
  prerelease: false
@@ -38,9 +30,6 @@ dependencies:
38
30
  requirements:
39
31
  - - ">="
40
32
  - !ruby/object:Gem::Version
41
- segments:
42
- - 3
43
- - 0
44
33
  version: "3.0"
45
34
  type: :runtime
46
35
  prerelease: false
@@ -52,8 +41,6 @@ dependencies:
52
41
  requirements:
53
42
  - - ">="
54
43
  - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
44
  version: "0"
58
45
  type: :runtime
59
46
  prerelease: false
@@ -65,8 +52,6 @@ dependencies:
65
52
  requirements:
66
53
  - - ">="
67
54
  - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
55
  version: "0"
71
56
  type: :runtime
72
57
  prerelease: false
@@ -78,10 +63,6 @@ dependencies:
78
63
  requirements:
79
64
  - - ~>
80
65
  - !ruby/object:Gem::Version
81
- segments:
82
- - 2
83
- - 5
84
- - 0
85
66
  version: 2.5.0
86
67
  type: :development
87
68
  prerelease: false
@@ -93,10 +74,6 @@ dependencies:
93
74
  requirements:
94
75
  - - ~>
95
76
  - !ruby/object:Gem::Version
96
- segments:
97
- - 1
98
- - 0
99
- - 0
100
77
  version: 1.0.0
101
78
  type: :development
102
79
  prerelease: false
@@ -108,11 +85,7 @@ dependencies:
108
85
  requirements:
109
86
  - - ~>
110
87
  - !ruby/object:Gem::Version
111
- segments:
112
- - 1
113
- - 5
114
- - 2
115
- version: 1.5.2
88
+ version: 1.6.3
116
89
  type: :development
117
90
  prerelease: false
118
91
  version_requirements: *id007
@@ -123,8 +96,6 @@ dependencies:
123
96
  requirements:
124
97
  - - ">="
125
98
  - !ruby/object:Gem::Version
126
- segments:
127
- - 0
128
99
  version: "0"
129
100
  type: :development
130
101
  prerelease: false
@@ -136,8 +107,6 @@ dependencies:
136
107
  requirements:
137
108
  - - ">="
138
109
  - !ruby/object:Gem::Version
139
- segments:
140
- - 0
141
110
  version: "0"
142
111
  type: :development
143
112
  prerelease: false
@@ -191,7 +160,6 @@ files:
191
160
  - spec/spec_helper.rb
192
161
  - LICENSE.txt
193
162
  - README.rdoc
194
- has_rdoc: true
195
163
  homepage: http://github.com/rgarner/semantically-taggable
196
164
  licenses:
197
165
  - MIT
@@ -205,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
173
  requirements:
206
174
  - - ">="
207
175
  - !ruby/object:Gem::Version
208
- hash: 1510912516109491173
176
+ hash: -3285678310656688866
209
177
  segments:
210
178
  - 0
211
179
  version: "0"
@@ -214,26 +182,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
182
  requirements:
215
183
  - - ">="
216
184
  - !ruby/object:Gem::Version
217
- segments:
218
- - 0
219
185
  version: "0"
220
186
  requirements: []
221
187
 
222
188
  rubyforge_project:
223
- rubygems_version: 1.3.7
189
+ rubygems_version: 1.8.5
224
190
  signing_key:
225
191
  specification_version: 3
226
192
  summary: A semantic tagging system for Rails 3
227
- test_files:
228
- - spec/database_seeder.rb
229
- - spec/models.rb
230
- - spec/schema.rb
231
- - spec/semantically_taggable/article_tagging_spec.rb
232
- - spec/semantically_taggable/scheme_spec.rb
233
- - spec/semantically_taggable/semantically-taggable_spec.rb
234
- - spec/semantically_taggable/shared_spec_helpers.rb
235
- - spec/semantically_taggable/tag_list_spec.rb
236
- - spec/semantically_taggable/tag_parentage_spec.rb
237
- - spec/semantically_taggable/tag_spec.rb
238
- - spec/semantically_taggable/tags_helper_spec.rb
239
- - spec/spec_helper.rb
193
+ test_files: []
194
+