acts-as-taggable-on 1.0.13 → 2.0.6

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.
Files changed (43) hide show
  1. data/CHANGELOG +5 -2
  2. data/Gemfile +10 -0
  3. data/README.rdoc +56 -26
  4. data/Rakefile +46 -16
  5. data/VERSION +1 -1
  6. data/generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb +7 -0
  7. data/generators/acts_as_taggable_on_migration/templates/migration.rb +29 -0
  8. data/lib/acts-as-taggable-on.rb +30 -7
  9. data/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb +53 -0
  10. data/lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb +132 -0
  11. data/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb +241 -0
  12. data/lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb +101 -0
  13. data/lib/acts_as_taggable_on/acts_as_taggable_on/related.rb +65 -0
  14. data/lib/acts_as_taggable_on/acts_as_taggable_on.rb +43 -373
  15. data/lib/acts_as_taggable_on/acts_as_tagger.rb +60 -45
  16. data/lib/acts_as_taggable_on/compatibility/Gemfile +8 -0
  17. data/lib/acts_as_taggable_on/compatibility/active_record_backports.rb +17 -0
  18. data/lib/acts_as_taggable_on/compatibility/postgresql.rb +44 -0
  19. data/lib/acts_as_taggable_on/tag.rb +70 -22
  20. data/lib/acts_as_taggable_on/tag_list.rb +81 -80
  21. data/lib/acts_as_taggable_on/tagging.rb +23 -7
  22. data/lib/acts_as_taggable_on/tags_helper.rb +14 -8
  23. data/lib/generators/acts_as_taggable_on/migration/migration_generator.rb +32 -0
  24. data/lib/generators/acts_as_taggable_on/migration/templates/active_record/migration.rb +28 -0
  25. data/rails/init.rb +1 -7
  26. data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +102 -55
  27. data/spec/acts_as_taggable_on/acts_as_tagger_spec.rb +48 -6
  28. data/spec/acts_as_taggable_on/tag_list_spec.rb +21 -3
  29. data/spec/acts_as_taggable_on/tag_spec.rb +77 -24
  30. data/spec/acts_as_taggable_on/taggable_spec.rb +173 -76
  31. data/spec/acts_as_taggable_on/tagger_spec.rb +74 -6
  32. data/spec/acts_as_taggable_on/tagging_spec.rb +22 -7
  33. data/spec/acts_as_taggable_on/tags_helper_spec.rb +4 -6
  34. data/spec/bm.rb +52 -0
  35. data/spec/database.yml +17 -0
  36. data/spec/database.yml.sample +17 -0
  37. data/spec/models.rb +31 -0
  38. data/spec/schema.rb +13 -2
  39. data/spec/spec_helper.rb +52 -40
  40. metadata +31 -9
  41. data/lib/acts_as_taggable_on/group_helper.rb +0 -12
  42. data/spec/acts_as_taggable_on/group_helper_spec.rb +0 -18
  43. data/spec/spec.opts +0 -3
@@ -1,13 +1,19 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe "Acts As Taggable On" do
4
+ before(:each) do
5
+ clean_database!
6
+ end
7
+
4
8
  it "should provide a class method 'taggable?' that is false for untaggable models" do
5
9
  UntaggableModel.should_not be_taggable
6
10
  end
7
11
 
8
12
  describe "Taggable Method Generation" do
9
13
  before(:each) do
10
- [TaggableModel, Tag, Tagging, TaggableUser].each(&:delete_all)
14
+ clean_database!
15
+ TaggableModel.write_inheritable_attribute(:tag_types, [])
16
+ TaggableModel.acts_as_taggable_on(:tags, :languages, :skills, :needs, :offerings)
11
17
  @taggable = TaggableModel.new(:name => "Bob Jones")
12
18
  end
13
19
 
@@ -18,32 +24,31 @@ describe "Acts As Taggable On" do
18
24
  it "should create a class attribute for tag types" do
19
25
  @taggable.class.should respond_to(:tag_types)
20
26
  end
21
-
27
+
22
28
  it "should create an instance attribute for tag types" do
23
29
  @taggable.should respond_to(:tag_types)
24
30
  end
31
+
32
+ it "should have all tag types" do
33
+ @taggable.tag_types.should == [:tags, :languages, :skills, :needs, :offerings]
34
+ end
25
35
 
26
36
  it "should generate an association for each tag type" do
27
37
  @taggable.should respond_to(:tags, :skills, :languages)
28
38
  end
29
39
 
30
- it "should generate a cached column checker for each tag type" do
31
- TaggableModel.should respond_to(:caching_tag_list?, :caching_skill_list?, :caching_language_list?)
32
- end
33
-
34
40
  it "should add tagged_with and tag_counts to singleton" do
35
- TaggableModel.should respond_to(:find_tagged_with, :tag_counts)
36
- end
37
-
38
- it "should add saving of tag lists and cached tag lists to the instance" do
39
- @taggable.should respond_to(:save_cached_tag_list)
40
- @taggable.should respond_to(:save_tags)
41
+ TaggableModel.should respond_to(:tagged_with, :tag_counts)
41
42
  end
42
43
 
43
44
  it "should generate a tag_list accessor/setter for each tag type" do
44
45
  @taggable.should respond_to(:tag_list, :skill_list, :language_list)
45
46
  @taggable.should respond_to(:tag_list=, :skill_list=, :language_list=)
46
47
  end
48
+
49
+ it "should generate a tag_list accessor, that includes owned tags, for each tag type" do
50
+ @taggable.should respond_to(:all_tags_list, :all_skills_list, :all_languages_list)
51
+ end
47
52
  end
48
53
 
49
54
  describe "Single Table Inheritance" do
@@ -52,17 +57,17 @@ describe "Acts As Taggable On" do
52
57
  @inherited_same = InheritingTaggableModel.new(:name => "inherited same")
53
58
  @inherited_different = AlteredInheritingTaggableModel.new(:name => "inherited different")
54
59
  end
55
-
60
+
56
61
  it "should pass on tag contexts to STI-inherited models" do
57
62
  @inherited_same.should respond_to(:tag_list, :skill_list, :language_list)
58
63
  @inherited_different.should respond_to(:tag_list, :skill_list, :language_list)
59
64
  end
60
-
65
+
61
66
  it "should have tag contexts added in altered STI models" do
62
67
  @inherited_different.should respond_to(:part_list)
63
68
  end
64
69
  end
65
-
70
+
66
71
  describe "Reloading" do
67
72
  it "should save a model instantiated by Model.find" do
68
73
  taggable = TaggableModel.create!(:name => "Taggable")
@@ -76,48 +81,48 @@ describe "Acts As Taggable On" do
76
81
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
77
82
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
78
83
  taggable3 = TaggableModel.create!(:name => "Taggable 3")
79
-
84
+
80
85
  taggable1.tag_list = "one, two"
81
86
  taggable1.save
82
-
87
+
83
88
  taggable2.tag_list = "three, four"
84
89
  taggable2.save
85
-
90
+
86
91
  taggable3.tag_list = "one, four"
87
92
  taggable3.save
88
-
93
+
89
94
  taggable1.find_related_tags.should include(taggable3)
90
95
  taggable1.find_related_tags.should_not include(taggable2)
91
96
  end
92
-
97
+
93
98
  it "should find other related objects based on tag names on context" do
94
99
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
95
100
  taggable2 = OtherTaggableModel.create!(:name => "Taggable 2")
96
101
  taggable3 = OtherTaggableModel.create!(:name => "Taggable 3")
97
-
102
+
98
103
  taggable1.tag_list = "one, two"
99
104
  taggable1.save
100
-
105
+
101
106
  taggable2.tag_list = "three, four"
102
107
  taggable2.save
103
-
108
+
104
109
  taggable3.tag_list = "one, four"
105
110
  taggable3.save
106
-
111
+
107
112
  taggable1.find_related_tags_for(OtherTaggableModel).should include(taggable3)
108
113
  taggable1.find_related_tags_for(OtherTaggableModel).should_not include(taggable2)
109
114
  end
110
-
115
+
111
116
  it "should not include the object itself in the list of related objects" do
112
117
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
113
118
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
114
-
119
+
115
120
  taggable1.tag_list = "one"
116
121
  taggable1.save
117
-
122
+
118
123
  taggable2.tag_list = "one, two"
119
124
  taggable2.save
120
-
125
+
121
126
  taggable1.find_related_tags.should include(taggable2)
122
127
  taggable1.find_related_tags.should_not include(taggable1)
123
128
  end
@@ -128,64 +133,54 @@ describe "Acts As Taggable On" do
128
133
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
129
134
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
130
135
  taggable3 = TaggableModel.create!(:name => "Taggable 3")
131
-
136
+
132
137
  taggable1.offering_list = "one, two"
133
138
  taggable1.save!
134
-
139
+
135
140
  taggable2.need_list = "one, two"
136
141
  taggable2.save!
137
-
142
+
138
143
  taggable3.offering_list = "one, two"
139
144
  taggable3.save!
140
-
145
+
141
146
  taggable1.find_matching_contexts(:offerings, :needs).should include(taggable2)
142
147
  taggable1.find_matching_contexts(:offerings, :needs).should_not include(taggable3)
143
148
  end
144
-
149
+
145
150
  it "should find other related objects with tags of matching contexts" do
146
151
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
147
152
  taggable2 = OtherTaggableModel.create!(:name => "Taggable 2")
148
153
  taggable3 = OtherTaggableModel.create!(:name => "Taggable 3")
149
-
154
+
150
155
  taggable1.offering_list = "one, two"
151
156
  taggable1.save
152
-
157
+
153
158
  taggable2.need_list = "one, two"
154
159
  taggable2.save
155
-
160
+
156
161
  taggable3.offering_list = "one, two"
157
162
  taggable3.save
158
-
163
+
159
164
  taggable1.find_matching_contexts_for(OtherTaggableModel, :offerings, :needs).should include(taggable2)
160
165
  taggable1.find_matching_contexts_for(OtherTaggableModel, :offerings, :needs).should_not include(taggable3)
161
166
  end
162
-
167
+
163
168
  it "should not include the object itself in the list of related objects" do
164
169
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
165
170
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
166
-
171
+
167
172
  taggable1.tag_list = "one"
168
173
  taggable1.save
169
-
174
+
170
175
  taggable2.tag_list = "one, two"
171
176
  taggable2.save
172
-
177
+
173
178
  taggable1.find_related_tags.should include(taggable2)
174
179
  taggable1.find_related_tags.should_not include(taggable1)
175
180
  end
176
181
  end
177
182
 
178
183
  describe 'Tagging Contexts' do
179
- before(:all) do
180
- class Array
181
- def freq
182
- k=Hash.new(0)
183
- self.each {|e| k[e]+=1}
184
- k
185
- end
186
- end
187
- end
188
-
189
184
  it 'should eliminate duplicate tagging contexts ' do
190
185
  TaggableModel.acts_as_taggable_on(:skills, :skills)
191
186
  TaggableModel.tag_types.freq[:skills].should_not == 3
@@ -212,10 +207,62 @@ describe "Acts As Taggable On" do
212
207
  TaggableModel.acts_as_taggable_on([nil])
213
208
  }.should_not raise_error
214
209
  end
210
+ end
211
+
212
+ describe 'Caching' do
213
+ before(:each) do
214
+ @taggable = CachedModel.new(:name => "Bob Jones")
215
+ end
216
+
217
+ it "should add saving of tag lists and cached tag lists to the instance" do
218
+ @taggable.should respond_to(:save_cached_tag_list)
219
+ @taggable.should respond_to(:save_tags)
220
+ end
215
221
 
216
- after(:all) do
217
- class Array; remove_method :freq; end
222
+ it "should generate a cached column checker for each tag type" do
223
+ CachedModel.should respond_to(:caching_tag_list?)
224
+ end
225
+
226
+ it 'should not have cached tags' do
227
+ @taggable.cached_tag_list.should be_blank
228
+ end
229
+
230
+ it 'should cache tags' do
231
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
232
+ @taggable.cached_tag_list.should == 'awesome, epic'
233
+ end
234
+
235
+ it 'should keep the cache' do
236
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
237
+ @taggable = CachedModel.find(@taggable)
238
+ @taggable.save!
239
+ @taggable.cached_tag_list.should == 'awesome, epic'
240
+ end
241
+
242
+ it 'should update the cache' do
243
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
244
+ @taggable.update_attributes(:tag_list => 'awesome')
245
+ @taggable.cached_tag_list.should == 'awesome'
246
+ end
247
+
248
+ it 'should remove the cache' do
249
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
250
+ @taggable.update_attributes(:tag_list => '')
251
+ @taggable.cached_tag_list.should be_blank
252
+ end
253
+
254
+ it 'should have a tag list' do
255
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
256
+ @taggable = CachedModel.find(@taggable.id)
257
+ @taggable.tag_list.sort.should == %w(awesome epic).sort
258
+ end
259
+
260
+ it 'should keep the tag list' do
261
+ @taggable.update_attributes(:tag_list => 'awesome, epic')
262
+ @taggable = CachedModel.find(@taggable.id)
263
+ @taggable.save!
264
+ @taggable.tag_list.sort.should == %w(awesome epic).sort
218
265
  end
219
266
  end
220
267
 
221
- end
268
+ end
@@ -1,8 +1,11 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
3
  describe "acts_as_tagger" do
4
- context "Tagger Method Generation" do
5
-
4
+ before(:each) do
5
+ clean_database!
6
+ end
7
+
8
+ describe "Tagger Method Generation" do
6
9
  before(:each) do
7
10
  @tagger = TaggableUser.new()
8
11
  end
@@ -48,8 +51,23 @@ describe "acts_as_tagger" do
48
51
 
49
52
  it 'should by default create the tag context on-the-fly' do
50
53
  @taggable.tag_list_on(:here_ond_now).should be_empty
51
- @tagger.tag(@taggable, :with=>'that', :on=>:here_ond_now)
52
- @taggable.tag_list_on(:here_ond_now).should include('that')
54
+ @tagger.tag(@taggable, :with=>'that', :on => :here_ond_now)
55
+ @taggable.tag_list_on(:here_ond_now).should_not include('that')
56
+ @taggable.all_tags_list_on(:here_ond_now).should include('that')
57
+ end
58
+
59
+ it "should show all the tag list when both public and owned tags exist" do
60
+ @taggable.tag_list = 'ruby, python'
61
+ @tagger.tag(@taggable, :with => 'java, lisp', :on => :tags)
62
+ @taggable.all_tags_on(:tags).map(&:name).sort.should == %w(ruby python java lisp).sort
63
+ end
64
+
65
+ it "should not add owned tags to the common list" do
66
+ @taggable.tag_list = 'ruby, python'
67
+ @tagger.tag(@taggable, :with => 'java, lisp', :on => :tags)
68
+ @taggable.tag_list.should == %w(ruby python)
69
+ @tagger.tag(@taggable, :with => '', :on => :tags)
70
+ @taggable.tag_list.should == %w(ruby python)
53
71
  end
54
72
 
55
73
  it "should throw an exception when the default is over-ridden" do
@@ -64,9 +82,33 @@ describe "acts_as_tagger" do
64
82
  @tagger.tag(@taggable, :with=>'this, and, that', :on=>:foo_boo, :force=>false) rescue
65
83
  @taggable.tag_list_on(:foo_boo).should be_empty
66
84
  end
85
+ end
86
+
87
+ describe "when called by multiple tagger's" do
88
+ before(:each) do
89
+ @user_x = TaggableUser.create(:name => "User X")
90
+ @user_y = TaggableUser.create(:name => "User Y")
91
+ @taggable = TaggableModel.create(:name => 'acts_as_taggable_on', :tag_list => 'plugin')
92
+
93
+ @user_x.tag(@taggable, :with => 'ruby, rails', :on => :tags)
94
+ @user_y.tag(@taggable, :with => 'ruby, plugin', :on => :tags)
67
95
 
96
+ @user_y.tag(@taggable, :with => '', :on => :tags)
97
+ @user_y.tag(@taggable, :with => '', :on => :tags)
98
+ end
99
+
100
+ it "should delete owned tags" do
101
+ @user_y.owned_tags.should == []
102
+ end
103
+
104
+ it "should not delete other taggers tags" do
105
+ @user_x.owned_tags.should have(2).items
106
+ end
107
+
108
+ it "should not delete original tags" do
109
+ @taggable.all_tags_list_on(:tags).should include('plugin')
110
+ end
68
111
  end
69
-
70
112
  end
71
113
 
72
114
  end
@@ -1,8 +1,8 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
- describe TagList do
3
+ describe ActsAsTaggableOn::TagList do
4
4
  before(:each) do
5
- @tag_list = TagList.new("awesome","radical")
5
+ @tag_list = ActsAsTaggableOn::TagList.new("awesome","radical")
6
6
  end
7
7
 
8
8
  it "should be an array" do
@@ -20,6 +20,18 @@ describe TagList do
20
20
  @tag_list.include?("wicked").should be_true
21
21
  end
22
22
 
23
+ it "should be able to add delimited list of words with quoted delimiters" do
24
+ @tag_list.add("'cool, wicked', \"really cool, really wicked\"", :parse => true)
25
+ @tag_list.include?("cool, wicked").should be_true
26
+ @tag_list.include?("really cool, really wicked").should be_true
27
+ end
28
+
29
+ it "should be able to handle other uses of quotation marks correctly" do
30
+ @tag_list.add("john's cool car, mary's wicked toy", :parse => true)
31
+ @tag_list.include?("john's cool car").should be_true
32
+ @tag_list.include?("mary's wicked toy").should be_true
33
+ end
34
+
23
35
  it "should be able to add an array of words" do
24
36
  @tag_list.add(["cool", "wicked"], :parse => true)
25
37
  @tag_list.include?("cool").should be_true
@@ -49,4 +61,10 @@ describe TagList do
49
61
  @tag_list.add("cool","rad,bodacious")
50
62
  @tag_list.to_s.should == "awesome, radical, cool, \"rad,bodacious\""
51
63
  end
64
+
65
+ it "should be able to call to_s on a frozen tag list" do
66
+ @tag_list.freeze
67
+ lambda { @tag_list.add("cool","rad,bodacious") }.should raise_error
68
+ lambda { @tag_list.to_s }.should_not raise_error
69
+ end
52
70
  end
@@ -1,62 +1,115 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.expand_path('../../spec_helper', __FILE__)
2
2
 
3
- describe Tag do
3
+ describe ActsAsTaggableOn::Tag do
4
4
  before(:each) do
5
- @tag = Tag.new
6
- @user = TaggableModel.create(:name => "Pablo")
7
- Tag.delete_all
5
+ clean_database!
6
+ @tag = ActsAsTaggableOn::Tag.new
7
+ @user = TaggableModel.create(:name => "Pablo")
8
8
  end
9
-
9
+
10
+ describe "named like any" do
11
+ before(:each) do
12
+ ActsAsTaggableOn::Tag.create(:name => "awesome")
13
+ ActsAsTaggableOn::Tag.create(:name => "epic")
14
+ end
15
+
16
+ it "should find both tags" do
17
+ ActsAsTaggableOn::Tag.named_like_any(["awesome", "epic"]).should have(2).items
18
+ end
19
+ end
20
+
10
21
  describe "find or create by name" do
11
22
  before(:each) do
12
23
  @tag.name = "awesome"
13
24
  @tag.save
14
25
  end
15
-
26
+
16
27
  it "should find by name" do
17
- Tag.find_or_create_with_like_by_name("awesome").should == @tag
28
+ ActsAsTaggableOn::Tag.find_or_create_with_like_by_name("awesome").should == @tag
18
29
  end
19
-
30
+
20
31
  it "should find by name case insensitive" do
21
- Tag.find_or_create_with_like_by_name("AWESOME").should == @tag
32
+ ActsAsTaggableOn::Tag.find_or_create_with_like_by_name("AWESOME").should == @tag
22
33
  end
23
-
34
+
24
35
  it "should create by name" do
25
36
  lambda {
26
- Tag.find_or_create_with_like_by_name("epic")
27
- }.should change(Tag, :count).by(1)
37
+ ActsAsTaggableOn::Tag.find_or_create_with_like_by_name("epic")
38
+ }.should change(ActsAsTaggableOn::Tag, :count).by(1)
39
+ end
40
+ end
41
+
42
+ describe "find or create all by any name" do
43
+ before(:each) do
44
+ @tag.name = "awesome"
45
+ @tag.save
46
+ end
47
+
48
+ it "should find by name" do
49
+ ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name("awesome").should == [@tag]
50
+ end
51
+
52
+ it "should find by name case insensitive" do
53
+ ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name("AWESOME").should == [@tag]
54
+ end
55
+
56
+ it "should create by name" do
57
+ lambda {
58
+ ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name("epic")
59
+ }.should change(ActsAsTaggableOn::Tag, :count).by(1)
60
+ end
61
+
62
+ it "should find or create by name" do
63
+ lambda {
64
+ ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name("awesome", "epic").map(&:name).should == ["awesome", "epic"]
65
+ }.should change(ActsAsTaggableOn::Tag, :count).by(1)
66
+ end
67
+
68
+ it "should return an empty array if no tags are specified" do
69
+ ActsAsTaggableOn::Tag.find_or_create_all_with_like_by_name([]).should == []
28
70
  end
29
71
  end
30
72
 
31
73
  it "should require a name" do
32
74
  @tag.valid?
33
- @tag.errors.on(:name).should == "can't be blank"
75
+
76
+ if ActiveRecord::VERSION::MAJOR >= 3
77
+ @tag.errors[:name].should == ["can't be blank"]
78
+ else
79
+ @tag.errors[:name].should == "can't be blank"
80
+ end
81
+
34
82
  @tag.name = "something"
35
83
  @tag.valid?
36
- @tag.errors.on(:name).should be_nil
84
+
85
+ if ActiveRecord::VERSION::MAJOR >= 3
86
+ @tag.errors[:name].should == []
87
+ else
88
+ @tag.errors[:name].should be_nil
89
+ end
37
90
  end
38
-
91
+
39
92
  it "should equal a tag with the same name" do
40
93
  @tag.name = "awesome"
41
- new_tag = Tag.new(:name => "awesome")
94
+ new_tag = ActsAsTaggableOn::Tag.new(:name => "awesome")
42
95
  new_tag.should == @tag
43
96
  end
44
-
97
+
45
98
  it "should return its name when to_s is called" do
46
99
  @tag.name = "cool"
47
100
  @tag.to_s.should == "cool"
48
101
  end
49
-
102
+
50
103
  it "have named_scope named(something)" do
51
104
  @tag.name = "cool"
52
105
  @tag.save!
53
- Tag.named('cool').should include(@tag)
106
+ ActsAsTaggableOn::Tag.named('cool').should include(@tag)
54
107
  end
55
-
108
+
56
109
  it "have named_scope named_like(something)" do
57
110
  @tag.name = "cool"
58
111
  @tag.save!
59
- @another_tag = Tag.create!(:name => "coolip")
60
- Tag.named_like('cool').should include(@tag, @another_tag)
112
+ @another_tag = ActsAsTaggableOn::Tag.create!(:name => "coolip")
113
+ ActsAsTaggableOn::Tag.named_like('cool').should include(@tag, @another_tag)
61
114
  end
62
- end
115
+ end