acts-as-taggable-on 2.4.0 → 2.4.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Appraisals +7 -0
- data/Gemfile +3 -1
- data/{MIT-LICENSE.md → LICENSE.md} +0 -0
- data/README.md +22 -16
- data/Rakefile +2 -2
- data/acts-as-taggable-on.gemspec +22 -19
- data/gemfiles/rails_3.gemfile +8 -0
- data/gemfiles/rails_4.gemfile +8 -0
- data/lib/acts-as-taggable-on.rb +2 -0
- data/lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb +5 -7
- data/lib/acts_as_taggable_on/acts_as_taggable_on/compatibility.rb +34 -0
- data/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb +75 -50
- data/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb +1 -1
- data/lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb +21 -12
- data/lib/acts_as_taggable_on/acts_as_taggable_on/related.rb +27 -18
- data/lib/acts_as_taggable_on/tag.rb +8 -8
- data/lib/acts_as_taggable_on/taggable.rb +10 -7
- data/lib/acts_as_taggable_on/tagger.rb +12 -3
- data/lib/acts_as_taggable_on/tagging.rb +2 -2
- data/lib/acts_as_taggable_on/tags_helper.rb +0 -2
- data/lib/{acts-as-taggable-on → acts_as_taggable_on}/version.rb +1 -1
- data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +1 -216
- data/spec/acts_as_taggable_on/acts_as_tagger_spec.rb +8 -8
- data/spec/acts_as_taggable_on/related_spec.rb +143 -0
- data/spec/acts_as_taggable_on/single_table_inheritance_spec.rb +187 -0
- data/spec/acts_as_taggable_on/tag_list_spec.rb +2 -2
- data/spec/acts_as_taggable_on/tag_spec.rb +3 -4
- data/spec/acts_as_taggable_on/taggable_spec.rb +127 -116
- data/spec/acts_as_taggable_on/tagger_spec.rb +32 -33
- data/spec/acts_as_taggable_on/tagging_spec.rb +1 -1
- data/spec/acts_as_taggable_on/tags_helper_spec.rb +2 -2
- data/spec/acts_as_taggable_on/utils_spec.rb +2 -2
- data/spec/models.rb +2 -2
- data/spec/schema.rb +1 -1
- data/spec/spec_helper.rb +7 -4
- metadata +48 -34
- data/CHANGELOG.md +0 -35
- data/UPGRADING +0 -14
- data/rails/init.rb +0 -1
- data/uninstall.rb +0 -1
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Tagger" do
|
4
4
|
before(:each) do
|
5
5
|
clean_database!
|
6
|
-
@user =
|
6
|
+
@user = User.create
|
7
7
|
@taggable = TaggableModel.create(:name => "Bob Jones")
|
8
8
|
end
|
9
9
|
|
@@ -21,18 +21,43 @@ describe "Tagger" do
|
|
21
21
|
@taggable2 = TaggableModel.create(:name => "Jim Jones")
|
22
22
|
@taggable3 = TaggableModel.create(:name => "Jane Doe")
|
23
23
|
|
24
|
-
@user2 =
|
24
|
+
@user2 = User.new
|
25
25
|
@user.tag(@taggable, :with => 'ruby, scheme', :on => :tags)
|
26
26
|
@user2.tag(@taggable2, :with => 'ruby, scheme', :on => :tags)
|
27
27
|
@user2.tag(@taggable3, :with => 'ruby, scheme', :on => :tags)
|
28
28
|
|
29
29
|
TaggableModel.tagged_with(%w(ruby scheme), :owned_by => @user).count.should == 1
|
30
30
|
TaggableModel.tagged_with(%w(ruby scheme), :owned_by => @user2).count.should == 2
|
31
|
+
end
|
32
|
+
|
33
|
+
it "only returns objects tagged by owned_by when any is true" do
|
34
|
+
@user2 = User.new
|
35
|
+
@taggable2 = TaggableModel.create(:name => "Jim Jones")
|
36
|
+
@taggable3 = TaggableModel.create(:name => "Jane Doe")
|
31
37
|
|
38
|
+
@user.tag(@taggable, :with => 'ruby', :on => :tags)
|
39
|
+
@user.tag(@taggable2, :with => 'java', :on => :tags)
|
40
|
+
@user2.tag(@taggable3, :with => 'ruby', :on => :tags)
|
41
|
+
|
42
|
+
tags = TaggableModel.tagged_with(%w(ruby java), :owned_by => @user, :any => true)
|
43
|
+
tags.should match_array [@taggable, @taggable2]
|
44
|
+
end
|
45
|
+
|
46
|
+
it "only returns objects tagged by owned_by when exclude is true" do
|
47
|
+
@user2 = User.new
|
48
|
+
@taggable2 = TaggableModel.create(:name => "Jim Jones")
|
49
|
+
@taggable3 = TaggableModel.create(:name => "Jane Doe")
|
50
|
+
|
51
|
+
@user.tag(@taggable, :with => 'ruby', :on => :tags)
|
52
|
+
@user.tag(@taggable2, :with => 'java', :on => :tags)
|
53
|
+
@user2.tag(@taggable3, :with => 'java', :on => :tags)
|
54
|
+
|
55
|
+
tags = TaggableModel.tagged_with(%w(ruby), :owned_by => @user, :exclude => true)
|
56
|
+
tags.should match_array [@taggable2]
|
32
57
|
end
|
33
58
|
|
34
59
|
it "should not overlap tags from different taggers" do
|
35
|
-
@user2 =
|
60
|
+
@user2 = User.new
|
36
61
|
lambda{
|
37
62
|
@user.tag(@taggable, :with => 'ruby, scheme', :on => :tags)
|
38
63
|
@user2.tag(@taggable, :with => 'java, python, lisp, ruby', :on => :tags)
|
@@ -51,7 +76,7 @@ describe "Tagger" do
|
|
51
76
|
end
|
52
77
|
|
53
78
|
it "should not lose tags from different taggers" do
|
54
|
-
@user2 =
|
79
|
+
@user2 = User.create
|
55
80
|
@user2.tag(@taggable, :with => 'java, python, lisp, ruby', :on => :tags)
|
56
81
|
@user.tag(@taggable, :with => 'ruby, scheme', :on => :tags)
|
57
82
|
|
@@ -69,7 +94,7 @@ describe "Tagger" do
|
|
69
94
|
end
|
70
95
|
|
71
96
|
it "should not lose tags" do
|
72
|
-
@user2 =
|
97
|
+
@user2 = User.create
|
73
98
|
|
74
99
|
@user.tag(@taggable, :with => 'awesome', :on => :tags)
|
75
100
|
@user2.tag(@taggable, :with => 'awesome, epic', :on => :tags)
|
@@ -109,30 +134,4 @@ describe "Tagger" do
|
|
109
134
|
}.should_not change(ActsAsTaggableOn::Tagging, :count)
|
110
135
|
end
|
111
136
|
|
112
|
-
|
113
|
-
before do
|
114
|
-
@user3 = InheritingTaggableUser.create
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should have taggings" do
|
118
|
-
@user3.tag(@taggable, :with=>'ruby,scheme', :on=>:tags)
|
119
|
-
@user3.owned_taggings.size == 2
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should have tags" do
|
123
|
-
@user3.tag(@taggable, :with=>'ruby,scheme', :on=>:tags)
|
124
|
-
@user3.owned_tags.size == 2
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should return tags for the inheriting tagger" do
|
128
|
-
@user3.tag(@taggable, :with => 'ruby, scheme', :on => :tags)
|
129
|
-
@taggable.tags_from(@user3).sort.should == %w(ruby scheme).sort
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should scope objects returned by tagged_with by owners" do
|
133
|
-
@user3.tag(@taggable, :with => 'ruby, scheme', :on => :tags)
|
134
|
-
TaggableModel.tagged_with(%w(ruby scheme), :owned_by => @user3).count.should == 1
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
137
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActsAsTaggableOn::TagsHelper do
|
4
4
|
before(:each) do
|
@@ -41,4 +41,4 @@ describe ActsAsTaggableOn::TagsHelper do
|
|
41
41
|
tags["c++"].should == "sucky"
|
42
42
|
tags["php"].should == "sucky"
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActsAsTaggableOn::Utils do
|
4
4
|
describe "like_operator" do
|
@@ -18,4 +18,4 @@ describe ActsAsTaggableOn::Utils do
|
|
18
18
|
TaggableModel.send(:like_operator).should == "LIKE"
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/spec/models.rb
CHANGED
@@ -32,11 +32,11 @@ class AlteredInheritingTaggableModel < TaggableModel
|
|
32
32
|
acts_as_taggable_on :parts
|
33
33
|
end
|
34
34
|
|
35
|
-
class
|
35
|
+
class User < ActiveRecord::Base
|
36
36
|
acts_as_tagger
|
37
37
|
end
|
38
38
|
|
39
|
-
class
|
39
|
+
class Student < User
|
40
40
|
end
|
41
41
|
|
42
42
|
class UntaggableModel < ActiveRecord::Base
|
data/spec/schema.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -58,15 +58,18 @@ if File.exists?(database_yml)
|
|
58
58
|
ActiveRecord::Base.establish_connection(config)
|
59
59
|
end
|
60
60
|
|
61
|
-
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
|
61
|
+
logger = ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
|
62
62
|
ActiveRecord::Base.default_timezone = :utc
|
63
63
|
|
64
|
-
|
64
|
+
begin
|
65
|
+
old_logger_level, logger.level = logger.level, ::Logger::ERROR
|
65
66
|
ActiveRecord::Migration.verbose = false
|
66
67
|
|
67
68
|
load(File.dirname(__FILE__) + '/schema.rb')
|
68
69
|
load(File.dirname(__FILE__) + '/models.rb')
|
69
|
-
|
70
|
+
ensure
|
71
|
+
logger.level = old_logger_level
|
72
|
+
end
|
70
73
|
|
71
74
|
else
|
72
75
|
raise "Please create #{database_yml} first to configure your database. Take a look at: #{database_yml}.sample"
|
@@ -74,7 +77,7 @@ end
|
|
74
77
|
|
75
78
|
def clean_database!
|
76
79
|
models = [ActsAsTaggableOn::Tag, ActsAsTaggableOn::Tagging, TaggableModel, OtherTaggableModel, InheritingTaggableModel,
|
77
|
-
AlteredInheritingTaggableModel,
|
80
|
+
AlteredInheritingTaggableModel, User, UntaggableModel, OrderedTaggableModel]
|
78
81
|
models.each do |model|
|
79
82
|
ActiveRecord::Base.connection.execute "DELETE FROM #{model.table_name}"
|
80
83
|
end
|
metadata
CHANGED
@@ -1,29 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-taggable-on
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
8
|
+
- Joost Baaij
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '3'
|
21
|
+
- - <
|
18
22
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
23
|
+
version: '5'
|
20
24
|
type: :runtime
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
|
-
- -
|
28
|
+
- - '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '3'
|
31
|
+
- - <
|
25
32
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
33
|
+
version: '5'
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rspec-rails
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.13.0
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.13.0
|
27
48
|
- !ruby/object:Gem::Dependency
|
28
49
|
name: rspec
|
29
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +63,16 @@ dependencies:
|
|
42
63
|
name: ammeter
|
43
64
|
requirement: !ruby/object:Gem::Requirement
|
44
65
|
requirements:
|
45
|
-
- -
|
66
|
+
- - '>='
|
46
67
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
68
|
+
version: '0'
|
48
69
|
type: :development
|
49
70
|
prerelease: false
|
50
71
|
version_requirements: !ruby/object:Gem::Requirement
|
51
72
|
requirements:
|
52
|
-
- -
|
73
|
+
- - '>='
|
53
74
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
75
|
+
version: '0'
|
55
76
|
- !ruby/object:Gem::Dependency
|
56
77
|
name: sqlite3
|
57
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +145,9 @@ dependencies:
|
|
124
145
|
version: '0'
|
125
146
|
description: With ActsAsTaggableOn, you can tag a single model on several contexts,
|
126
147
|
such as skills, interests, and awards. It also provides other advanced functionality.
|
127
|
-
email:
|
148
|
+
email:
|
149
|
+
- michael@intridea.com
|
150
|
+
- joost@spacebabies.nl
|
128
151
|
executables: []
|
129
152
|
extensions: []
|
130
153
|
extra_rdoc_files: []
|
@@ -132,18 +155,19 @@ files:
|
|
132
155
|
- .gitignore
|
133
156
|
- .rspec
|
134
157
|
- .travis.yml
|
135
|
-
-
|
158
|
+
- Appraisals
|
136
159
|
- Gemfile
|
137
160
|
- Guardfile
|
138
|
-
-
|
161
|
+
- LICENSE.md
|
139
162
|
- README.md
|
140
163
|
- Rakefile
|
141
|
-
- UPGRADING
|
142
164
|
- acts-as-taggable-on.gemspec
|
165
|
+
- gemfiles/rails_3.gemfile
|
166
|
+
- gemfiles/rails_4.gemfile
|
143
167
|
- lib/acts-as-taggable-on.rb
|
144
|
-
- lib/acts-as-taggable-on/version.rb
|
145
168
|
- lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb
|
146
169
|
- lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
|
170
|
+
- lib/acts_as_taggable_on/acts_as_taggable_on/compatibility.rb
|
147
171
|
- lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
|
148
172
|
- lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
|
149
173
|
- lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb
|
@@ -155,11 +179,13 @@ files:
|
|
155
179
|
- lib/acts_as_taggable_on/tagging.rb
|
156
180
|
- lib/acts_as_taggable_on/tags_helper.rb
|
157
181
|
- lib/acts_as_taggable_on/utils.rb
|
182
|
+
- lib/acts_as_taggable_on/version.rb
|
158
183
|
- lib/generators/acts_as_taggable_on/migration/migration_generator.rb
|
159
184
|
- lib/generators/acts_as_taggable_on/migration/templates/active_record/migration.rb
|
160
|
-
- rails/init.rb
|
161
185
|
- spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb
|
162
186
|
- spec/acts_as_taggable_on/acts_as_tagger_spec.rb
|
187
|
+
- spec/acts_as_taggable_on/related_spec.rb
|
188
|
+
- spec/acts_as_taggable_on/single_table_inheritance_spec.rb
|
163
189
|
- spec/acts_as_taggable_on/tag_list_spec.rb
|
164
190
|
- spec/acts_as_taggable_on/tag_spec.rb
|
165
191
|
- spec/acts_as_taggable_on/taggable_spec.rb
|
@@ -173,25 +199,11 @@ files:
|
|
173
199
|
- spec/models.rb
|
174
200
|
- spec/schema.rb
|
175
201
|
- spec/spec_helper.rb
|
176
|
-
|
177
|
-
|
178
|
-
|
202
|
+
homepage: https://github.com/mbleigh/acts-as-taggable-on
|
203
|
+
licenses:
|
204
|
+
- MIT
|
179
205
|
metadata: {}
|
180
|
-
post_install_message:
|
181
|
-
|
182
|
-
** acts-as-taggable-on version 2.4.0
|
183
|
-
|
184
|
-
Hello! This version is the first one released by me (@tilsammans),
|
185
|
-
a new maintainer on the project. It's been a while since the last
|
186
|
-
release and I am not 100% sure if any breaking changes have been
|
187
|
-
introduced. Please test your tagging functionality carefully.
|
188
|
-
|
189
|
-
From now on things should stabilize. Please check the project's
|
190
|
-
milestones and compatibilities stated in the readme. If you have
|
191
|
-
any questions, feel free to create an issue on github.
|
192
|
-
|
193
|
-
https://github.com/mbleigh/acts-as-taggable-on
|
194
|
-
|
206
|
+
post_install_message:
|
195
207
|
rdoc_options: []
|
196
208
|
require_paths:
|
197
209
|
- lib
|
@@ -214,6 +226,8 @@ summary: Advanced tagging for Rails.
|
|
214
226
|
test_files:
|
215
227
|
- spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb
|
216
228
|
- spec/acts_as_taggable_on/acts_as_tagger_spec.rb
|
229
|
+
- spec/acts_as_taggable_on/related_spec.rb
|
230
|
+
- spec/acts_as_taggable_on/single_table_inheritance_spec.rb
|
217
231
|
- spec/acts_as_taggable_on/tag_list_spec.rb
|
218
232
|
- spec/acts_as_taggable_on/tag_spec.rb
|
219
233
|
- spec/acts_as_taggable_on/taggable_spec.rb
|
data/CHANGELOG.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
## 2011-08-21
|
2
|
-
* escape _ and % for mysql and postgres (@tilsammans)
|
3
|
-
* Now depends on mysql2 gem
|
4
|
-
* tagged_with :any is chainable now (@jeffreyiacono)
|
5
|
-
* tagged_with(nil) returns scoped object
|
6
|
-
* Case-insensitivity for TaggedModel.tagged_with for PostgreSQL database
|
7
|
-
* tagged_with(' ') returns scoped object
|
8
|
-
* remove warning for rails 3.1 about class_inheritable_attribute
|
9
|
-
* use ActiveRecord migration_number to avoid clashs (@atd)
|
10
|
-
|
11
|
-
## 2010-02-17
|
12
|
-
* Converted the plugin to be compatible with Rails3
|
13
|
-
|
14
|
-
## 2009-12-02
|
15
|
-
|
16
|
-
* PostgreSQL is now supported (via morgoth)
|
17
|
-
|
18
|
-
## 2008-07-17
|
19
|
-
|
20
|
-
* Can now use a named_scope to find tags!
|
21
|
-
|
22
|
-
## 2008-06-23
|
23
|
-
|
24
|
-
* Can now find related objects of another class (tristanzdunn)
|
25
|
-
* Removed extraneous down migration cruft (azabaj)
|
26
|
-
|
27
|
-
## 2008-06-09
|
28
|
-
|
29
|
-
* Added support for Single Table Inheritance
|
30
|
-
* Adding gemspec and rails/init.rb for gemified plugin
|
31
|
-
|
32
|
-
## 2007-12-12
|
33
|
-
|
34
|
-
* Added ability to use dynamic tag contexts
|
35
|
-
* Fixed missing migration generator
|
data/UPGRADING
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
** acts-as-taggable-on version 2.4.0
|
3
|
-
|
4
|
-
Hello! This version is the first one released by me (@tilsammans),
|
5
|
-
a new maintainer on the project. It's been a while since the last
|
6
|
-
release and I am not 100% sure if any breaking changes have been
|
7
|
-
introduced. Please test your tagging functionality carefully.
|
8
|
-
|
9
|
-
From now on things should stabilize. Please check the project's
|
10
|
-
milestones and compatibilities stated in the readme. If you have
|
11
|
-
any questions, feel free to create an issue on github.
|
12
|
-
|
13
|
-
https://github.com/mbleigh/acts-as-taggable-on
|
14
|
-
|
data/rails/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'acts-as-taggable-on'
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|