acts-as-taggable-on 2.1.0 → 2.2.0

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 (33) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +1 -2
  3. data/CHANGELOG +10 -0
  4. data/README.rdoc +31 -63
  5. data/acts-as-taggable-on.gemspec +4 -3
  6. data/lib/acts-as-taggable-on/version.rb +1 -1
  7. data/lib/acts-as-taggable-on.rb +0 -4
  8. data/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb +1 -1
  9. data/lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb +1 -1
  10. data/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb +29 -17
  11. data/lib/acts_as_taggable_on/acts_as_taggable_on/related.rb +15 -15
  12. data/lib/acts_as_taggable_on/acts_as_taggable_on.rb +4 -13
  13. data/lib/acts_as_taggable_on/tag.rb +12 -13
  14. data/lib/acts_as_taggable_on/tagging.rb +0 -2
  15. data/lib/acts_as_taggable_on/utils.rb +7 -8
  16. data/lib/generators/acts_as_taggable_on/migration/migration_generator.rb +9 -2
  17. data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +228 -61
  18. data/spec/acts_as_taggable_on/tag_list_spec.rb +4 -0
  19. data/spec/acts_as_taggable_on/tag_spec.rb +11 -15
  20. data/spec/acts_as_taggable_on/taggable_spec.rb +89 -27
  21. data/spec/acts_as_taggable_on/tagger_spec.rb +14 -0
  22. data/spec/acts_as_taggable_on/utils_spec.rb +2 -3
  23. data/spec/database.yml.sample +1 -1
  24. data/spec/generators/acts_as_taggable_on/migration/migration_generator_spec.rb +22 -0
  25. data/spec/models.rb +11 -2
  26. data/spec/schema.rb +7 -0
  27. data/spec/spec_helper.rb +1 -0
  28. metadata +95 -123
  29. data/VERSION +0 -1
  30. data/generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb +0 -7
  31. data/generators/acts_as_taggable_on_migration/templates/migration.rb +0 -29
  32. data/lib/acts_as_taggable_on/compatibility/Gemfile +0 -8
  33. data/lib/acts_as_taggable_on/compatibility/active_record_backports.rb +0 -21
@@ -12,7 +12,7 @@ describe "Acts As Taggable On" do
12
12
  describe "Taggable Method Generation" do
13
13
  before(:each) do
14
14
  clean_database!
15
- RAILS_3 ? TaggableModel.tag_types = [] : TaggableModel.write_inheritable_attribute(:tag_types, [])
15
+ TaggableModel.tag_types = []
16
16
  TaggableModel.acts_as_taggable_on(:tags, :languages, :skills, :needs, :offerings)
17
17
  @taggable = TaggableModel.new(:name => "Bob Jones")
18
18
  end
@@ -28,7 +28,7 @@ describe "Acts As Taggable On" do
28
28
  it "should create an instance attribute for tag types" do
29
29
  @taggable.should respond_to(:tag_types)
30
30
  end
31
-
31
+
32
32
  it "should have all tag types" do
33
33
  @taggable.tag_types.should == [:tags, :languages, :skills, :needs, :offerings]
34
34
  end
@@ -45,7 +45,7 @@ describe "Acts As Taggable On" do
45
45
  @taggable.should respond_to(:tag_list, :skill_list, :language_list)
46
46
  @taggable.should respond_to(:tag_list=, :skill_list=, :language_list=)
47
47
  end
48
-
48
+
49
49
  it "should generate a tag_list accessor, that includes owned tags, for each tag type" do
50
50
  @taggable.should respond_to(:all_tags_list, :all_skills_list, :all_languages_list)
51
51
  end
@@ -57,17 +57,17 @@ describe "Acts As Taggable On" do
57
57
  @inherited_same = InheritingTaggableModel.new(:name => "inherited same")
58
58
  @inherited_different = AlteredInheritingTaggableModel.new(:name => "inherited different")
59
59
  end
60
-
60
+
61
61
  it "should pass on tag contexts to STI-inherited models" do
62
62
  @inherited_same.should respond_to(:tag_list, :skill_list, :language_list)
63
63
  @inherited_different.should respond_to(:tag_list, :skill_list, :language_list)
64
64
  end
65
-
65
+
66
66
  it "should have tag contexts added in altered STI models" do
67
67
  @inherited_different.should respond_to(:part_list)
68
68
  end
69
69
  end
70
-
70
+
71
71
  describe "Reloading" do
72
72
  it "should save a model instantiated by Model.find" do
73
73
  taggable = TaggableModel.create!(:name => "Taggable")
@@ -81,51 +81,121 @@ describe "Acts As Taggable On" do
81
81
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
82
82
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
83
83
  taggable3 = TaggableModel.create!(:name => "Taggable 3")
84
-
84
+
85
+ taggable1.tag_list = "one, two"
86
+ taggable1.save
87
+
88
+ taggable2.tag_list = "three, four"
89
+ taggable2.save
90
+
91
+ taggable3.tag_list = "one, four"
92
+ taggable3.save
93
+
94
+ taggable1.find_related_tags.should include(taggable3)
95
+ taggable1.find_related_tags.should_not include(taggable2)
96
+ end
97
+
98
+ it "should find related objects based on tag names on context - non standard id" do
99
+ taggable1 = NonStandardIdTaggableModel.create!(:name => "Taggable 1")
100
+ taggable2 = NonStandardIdTaggableModel.create!(:name => "Taggable 2")
101
+ taggable3 = NonStandardIdTaggableModel.create!(:name => "Taggable 3")
102
+
85
103
  taggable1.tag_list = "one, two"
86
104
  taggable1.save
87
-
105
+
88
106
  taggable2.tag_list = "three, four"
89
107
  taggable2.save
90
-
108
+
91
109
  taggable3.tag_list = "one, four"
92
110
  taggable3.save
93
-
111
+
94
112
  taggable1.find_related_tags.should include(taggable3)
95
113
  taggable1.find_related_tags.should_not include(taggable2)
96
114
  end
97
-
115
+
98
116
  it "should find other related objects based on tag names on context" do
99
117
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
100
118
  taggable2 = OtherTaggableModel.create!(:name => "Taggable 2")
101
119
  taggable3 = OtherTaggableModel.create!(:name => "Taggable 3")
102
-
120
+
103
121
  taggable1.tag_list = "one, two"
104
122
  taggable1.save
105
-
123
+
106
124
  taggable2.tag_list = "three, four"
107
125
  taggable2.save
108
-
126
+
109
127
  taggable3.tag_list = "one, four"
110
128
  taggable3.save
111
-
129
+
112
130
  taggable1.find_related_tags_for(OtherTaggableModel).should include(taggable3)
113
131
  taggable1.find_related_tags_for(OtherTaggableModel).should_not include(taggable2)
114
132
  end
115
-
133
+
116
134
  it "should not include the object itself in the list of related objects" do
117
135
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
118
136
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
119
-
137
+
120
138
  taggable1.tag_list = "one"
121
139
  taggable1.save
122
-
140
+
123
141
  taggable2.tag_list = "one, two"
124
142
  taggable2.save
125
-
143
+
126
144
  taggable1.find_related_tags.should include(taggable2)
127
145
  taggable1.find_related_tags.should_not include(taggable1)
128
146
  end
147
+
148
+ it "should not include the object itself in the list of related objects - non standard id" do
149
+ taggable1 = NonStandardIdTaggableModel.create!(:name => "Taggable 1")
150
+ taggable2 = NonStandardIdTaggableModel.create!(:name => "Taggable 2")
151
+
152
+ taggable1.tag_list = "one"
153
+ taggable1.save
154
+
155
+ taggable2.tag_list = "one, two"
156
+ taggable2.save
157
+
158
+ taggable1.find_related_tags.should include(taggable2)
159
+ taggable1.find_related_tags.should_not include(taggable1)
160
+ end
161
+
162
+ context "Inherited Models" do
163
+ before do
164
+ @taggable1 = InheritingTaggableModel.create!(:name => "InheritingTaggable 1")
165
+ @taggable2 = InheritingTaggableModel.create!(:name => "InheritingTaggable 2")
166
+ @taggable3 = InheritingTaggableModel.create!(:name => "InheritingTaggable 3")
167
+ @taggable4 = TaggableModel.create!(:name => "Taggable 4")
168
+
169
+ @taggable1.tag_list = "one, two"
170
+ @taggable1.save
171
+
172
+ @taggable2.tag_list = "three, four"
173
+ @taggable2.save
174
+
175
+ @taggable3.tag_list = "one, four"
176
+ @taggable3.save
177
+
178
+ @taggable4.tag_list = "one, two, three, four"
179
+ @taggable4.save
180
+ end
181
+
182
+ it "should find related objects based on tag names on context" do
183
+ @taggable1.find_related_tags.should include(@taggable3)
184
+ @taggable1.find_related_tags.should_not include(@taggable2)
185
+ @taggable1.find_related_tags.should_not include(@taggable4)
186
+
187
+ @taggable1.find_related_tags_for(TaggableModel).should include(@taggable3)
188
+ @taggable1.find_related_tags_for(TaggableModel).should_not include(@taggable2)
189
+ @taggable1.find_related_tags_for(TaggableModel).should include(@taggable4)
190
+ end
191
+
192
+ it "should not include the object itself in the list of related objects" do
193
+ @taggable1.find_related_tags.should_not include(@taggable1)
194
+ @taggable1.find_related_tags_for(InheritingTaggableModel).should_not include(@taggable1)
195
+ @taggable1.find_related_tags_for(TaggableModel).should_not include(@taggable1)
196
+ end
197
+ end
198
+
129
199
  end
130
200
 
131
201
  describe "Matching Contexts" do
@@ -133,50 +203,95 @@ describe "Acts As Taggable On" do
133
203
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
134
204
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
135
205
  taggable3 = TaggableModel.create!(:name => "Taggable 3")
136
-
206
+
137
207
  taggable1.offering_list = "one, two"
138
208
  taggable1.save!
139
-
209
+
140
210
  taggable2.need_list = "one, two"
141
211
  taggable2.save!
142
-
212
+
143
213
  taggable3.offering_list = "one, two"
144
214
  taggable3.save!
145
-
215
+
146
216
  taggable1.find_matching_contexts(:offerings, :needs).should include(taggable2)
147
217
  taggable1.find_matching_contexts(:offerings, :needs).should_not include(taggable3)
148
218
  end
149
-
219
+
150
220
  it "should find other related objects with tags of matching contexts" do
151
221
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
152
222
  taggable2 = OtherTaggableModel.create!(:name => "Taggable 2")
153
223
  taggable3 = OtherTaggableModel.create!(:name => "Taggable 3")
154
-
224
+
155
225
  taggable1.offering_list = "one, two"
156
226
  taggable1.save
157
-
227
+
158
228
  taggable2.need_list = "one, two"
159
229
  taggable2.save
160
-
230
+
161
231
  taggable3.offering_list = "one, two"
162
232
  taggable3.save
163
-
233
+
164
234
  taggable1.find_matching_contexts_for(OtherTaggableModel, :offerings, :needs).should include(taggable2)
165
235
  taggable1.find_matching_contexts_for(OtherTaggableModel, :offerings, :needs).should_not include(taggable3)
166
236
  end
167
-
168
- it "should not include the object itself in the list of related objects" do
237
+
238
+ it "should not include the object itself in the list of related objects with tags of matching contexts" do
169
239
  taggable1 = TaggableModel.create!(:name => "Taggable 1")
170
240
  taggable2 = TaggableModel.create!(:name => "Taggable 2")
171
-
172
- taggable1.tag_list = "one"
241
+
242
+ taggable1.offering_list = "one, two"
243
+ taggable1.need_list = "one, two"
173
244
  taggable1.save
174
-
175
- taggable2.tag_list = "one, two"
245
+
246
+ taggable2.need_list = "one, two"
176
247
  taggable2.save
177
-
178
- taggable1.find_related_tags.should include(taggable2)
179
- taggable1.find_related_tags.should_not include(taggable1)
248
+
249
+ taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should include(taggable2)
250
+ taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should_not include(taggable1)
251
+ end
252
+
253
+ context "Inherited Models" do
254
+ before do
255
+ @taggable1 = InheritingTaggableModel.create!(:name => "InheritingTaggable 1")
256
+ @taggable2 = InheritingTaggableModel.create!(:name => "InheritingTaggable 2")
257
+ @taggable3 = InheritingTaggableModel.create!(:name => "InheritingTaggable 3")
258
+ @taggable4 = InheritingTaggableModel.create!(:name => "InheritingTaggable 4")
259
+ @taggable5 = TaggableModel.create!(:name => "Taggable 5")
260
+
261
+ @taggable1.offering_list = "one, two"
262
+ @taggable1.need_list = "one, two"
263
+ @taggable1.save!
264
+
265
+ @taggable2.need_list = "one, two"
266
+ @taggable2.save!
267
+
268
+ @taggable3.offering_list = "one, two"
269
+ @taggable3.save!
270
+
271
+ @taggable4.tag_list = "one, two, three, four"
272
+ @taggable4.save!
273
+
274
+ @taggable5.need_list = "one, two"
275
+ @taggable5.save!
276
+ end
277
+
278
+ it "should find objects with tags of matching contexts" do
279
+ @taggable1.find_matching_contexts(:offerings, :needs).should include(@taggable2)
280
+ @taggable1.find_matching_contexts(:offerings, :needs).should_not include(@taggable3)
281
+ @taggable1.find_matching_contexts(:offerings, :needs).should_not include(@taggable4)
282
+ @taggable1.find_matching_contexts(:offerings, :needs).should_not include(@taggable5)
283
+
284
+ @taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should include(@taggable2)
285
+ @taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should_not include(@taggable3)
286
+ @taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should_not include(@taggable4)
287
+ @taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should include(@taggable5)
288
+ end
289
+
290
+ it "should not include the object itself in the list of related objects with tags of matching contexts" do
291
+ @taggable1.find_matching_contexts(:offerings, :needs).should_not include(@taggable1)
292
+ @taggable1.find_matching_contexts_for(InheritingTaggableModel, :offerings, :needs).should_not include(@taggable1)
293
+ @taggable1.find_matching_contexts_for(TaggableModel, :offerings, :needs).should_not include(@taggable1)
294
+ end
180
295
  end
181
296
  end
182
297
 
@@ -208,67 +323,67 @@ describe "Acts As Taggable On" do
208
323
  }.should_not raise_error
209
324
  end
210
325
  end
211
-
326
+
212
327
  describe 'Caching' do
213
328
  before(:each) do
214
- @taggable = CachedModel.new(:name => "Bob Jones")
329
+ @taggable = CachedModel.new(:name => "Bob Jones")
215
330
  @another_taggable = OtherCachedModel.new(:name => "John Smith")
216
331
  end
217
-
332
+
218
333
  it "should add saving of tag lists and cached tag lists to the instance" do
219
334
  @taggable.should respond_to(:save_cached_tag_list)
220
335
  @another_taggable.should respond_to(:save_cached_tag_list)
221
-
336
+
222
337
  @taggable.should respond_to(:save_tags)
223
- end
338
+ end
224
339
 
225
340
  it "should add cached tag lists to the instance if cached column is not present" do
226
341
  TaggableModel.new(:name => "Art Kram").should_not respond_to(:save_cached_tag_list)
227
342
  end
228
-
343
+
229
344
  it "should generate a cached column checker for each tag type" do
230
345
  CachedModel.should respond_to(:caching_tag_list?)
231
346
  OtherCachedModel.should respond_to(:caching_language_list?)
232
- end
233
-
347
+ end
348
+
234
349
  it 'should not have cached tags' do
235
- @taggable.cached_tag_list.should be_blank
236
- @another_taggable.cached_language_list.should be_blank
350
+ @taggable.cached_tag_list.should be_blank
351
+ @another_taggable.cached_language_list.should be_blank
237
352
  end
238
-
353
+
239
354
  it 'should cache tags' do
240
355
  @taggable.update_attributes(:tag_list => 'awesome, epic')
241
356
  @taggable.cached_tag_list.should == 'awesome, epic'
242
-
357
+
243
358
  @another_taggable.update_attributes(:language_list => 'ruby, .net')
244
- @another_taggable.cached_language_list.should == 'ruby, .net'
359
+ @another_taggable.cached_language_list.should == 'ruby, .net'
245
360
  end
246
-
361
+
247
362
  it 'should keep the cache' do
248
363
  @taggable.update_attributes(:tag_list => 'awesome, epic')
249
- @taggable = CachedModel.find(@taggable)
364
+ @taggable = CachedModel.find(@taggable)
250
365
  @taggable.save!
251
- @taggable.cached_tag_list.should == 'awesome, epic'
366
+ @taggable.cached_tag_list.should == 'awesome, epic'
252
367
  end
253
-
368
+
254
369
  it 'should update the cache' do
255
370
  @taggable.update_attributes(:tag_list => 'awesome, epic')
256
371
  @taggable.update_attributes(:tag_list => 'awesome')
257
- @taggable.cached_tag_list.should == 'awesome'
372
+ @taggable.cached_tag_list.should == 'awesome'
258
373
  end
259
-
374
+
260
375
  it 'should remove the cache' do
261
376
  @taggable.update_attributes(:tag_list => 'awesome, epic')
262
377
  @taggable.update_attributes(:tag_list => '')
263
- @taggable.cached_tag_list.should be_blank
378
+ @taggable.cached_tag_list.should be_blank
264
379
  end
265
-
380
+
266
381
  it 'should have a tag list' do
267
382
  @taggable.update_attributes(:tag_list => 'awesome, epic')
268
383
  @taggable = CachedModel.find(@taggable.id)
269
384
  @taggable.tag_list.sort.should == %w(awesome epic).sort
270
385
  end
271
-
386
+
272
387
  it 'should keep the tag list' do
273
388
  @taggable.update_attributes(:tag_list => 'awesome, epic')
274
389
  @taggable = CachedModel.find(@taggable.id)
@@ -277,11 +392,63 @@ describe "Acts As Taggable On" do
277
392
  end
278
393
  end
279
394
 
280
- describe "taggings" do
395
+ context 'when tagging context ends in an "s" when singular (ex. "status", "glass", etc.)' do
396
+ describe 'caching' do
397
+ before { @taggable = OtherCachedModel.new(:name => "John Smith") }
398
+ subject { @taggable }
399
+
400
+ it { should respond_to(:save_cached_tag_list) }
401
+ its(:cached_language_list) { should be_blank }
402
+ its(:cached_status_list) { should be_blank }
403
+ its(:cached_glass_list) { should be_blank }
404
+
405
+ context 'language taggings cache after update' do
406
+ before { @taggable.update_attributes(:language_list => 'ruby, .net') }
407
+ subject { @taggable }
408
+
409
+ its(:language_list) { should == ['ruby', '.net']}
410
+ its(:cached_language_list) { should == 'ruby, .net' } # passes
411
+ its(:instance_variables) { should include((RUBY_VERSION < '1.9' ? '@language_list' : :@language_list)) }
412
+ end
413
+
414
+ context 'status taggings cache after update' do
415
+ before { @taggable.update_attributes(:status_list => 'happy, married') }
416
+ subject { @taggable }
417
+
418
+ its(:status_list) { should == ['happy', 'married'] }
419
+ its(:cached_status_list) { should == 'happy, married' } # fails
420
+ its(:cached_status_list) { should_not == '' } # fails, is blank
421
+ its(:instance_variables) { should include((RUBY_VERSION < '1.9' ? '@status_list' : :@status_list)) }
422
+ its(:instance_variables) { should_not include((RUBY_VERSION < '1.9' ? '@statu_list' : :@statu_list)) } # fails, note: one "s"
423
+
424
+ end
425
+
426
+ context 'glass taggings cache after update' do
427
+ before do
428
+ @taggable.update_attributes(:glass_list => 'rectangle, aviator')
429
+ end
430
+
431
+ subject { @taggable }
432
+ its(:glass_list) { should == ['rectangle', 'aviator'] }
433
+ its(:cached_glass_list) { should == 'rectangle, aviator' } # fails
434
+ its(:cached_glass_list) { should_not == '' } # fails, is blank
435
+ if RUBY_VERSION < '1.9'
436
+ its(:instance_variables) { should include('@glass_list') }
437
+ its(:instance_variables) { should_not include('@glas_list') } # fails, note: one "s"
438
+ else
439
+ its(:instance_variables) { should include(:@glass_list) }
440
+ its(:instance_variables) { should_not include(:@glas_list) } # fails, note: one "s"
441
+ end
442
+
443
+ end
444
+ end
445
+ end
446
+
447
+ describe "taggings" do
281
448
  before(:each) do
282
449
  @taggable = TaggableModel.new(:name => "Art Kram")
283
450
  end
284
-
451
+
285
452
  it 'should return [] taggings' do
286
453
  @taggable.taggings.should == []
287
454
  end
@@ -62,6 +62,10 @@ describe ActsAsTaggableOn::TagList do
62
62
  @tag_list.to_s.should == "awesome, radical, cool, \"rad,bodacious\""
63
63
  end
64
64
 
65
+ it "#from should return empty array if empty array is passed" do
66
+ ActsAsTaggableOn::TagList.from([]).should == []
67
+ end
68
+
65
69
  it "should be able to call to_s on a frozen tag list" do
66
70
  @tag_list.freeze
67
71
  lambda { @tag_list.add("cool","rad,bodacious") }.should raise_error
@@ -9,12 +9,13 @@ describe ActsAsTaggableOn::Tag do
9
9
 
10
10
  describe "named like any" do
11
11
  before(:each) do
12
+ ActsAsTaggableOn::Tag.create(:name => "Awesome")
12
13
  ActsAsTaggableOn::Tag.create(:name => "awesome")
13
14
  ActsAsTaggableOn::Tag.create(:name => "epic")
14
15
  end
15
16
 
16
17
  it "should find both tags" do
17
- ActsAsTaggableOn::Tag.named_like_any(["awesome", "epic"]).should have(2).items
18
+ ActsAsTaggableOn::Tag.named_like_any(["awesome", "epic"]).should have(3).items
18
19
  end
19
20
  end
20
21
 
@@ -72,7 +73,7 @@ describe ActsAsTaggableOn::Tag do
72
73
 
73
74
  it "should require a name" do
74
75
  @tag.valid?
75
-
76
+
76
77
  if ActiveRecord::VERSION::MAJOR >= 3
77
78
  @tag.errors[:name].should == ["can't be blank"]
78
79
  else
@@ -81,8 +82,8 @@ describe ActsAsTaggableOn::Tag do
81
82
 
82
83
  @tag.name = "something"
83
84
  @tag.valid?
84
-
85
- if ActiveRecord::VERSION::MAJOR >= 3
85
+
86
+ if ActiveRecord::VERSION::MAJOR >= 3
86
87
  @tag.errors[:name].should == []
87
88
  else
88
89
  @tag.errors[:name].should be_nil
@@ -112,24 +113,19 @@ describe ActsAsTaggableOn::Tag do
112
113
  @another_tag = ActsAsTaggableOn::Tag.create!(:name => "coolip")
113
114
  ActsAsTaggableOn::Tag.named_like('cool').should include(@tag, @another_tag)
114
115
  end
115
-
116
+
116
117
  describe "escape wildcard symbols in like requests" do
117
118
  before(:each) do
118
119
  @tag.name = "cool"
119
120
  @tag.save
120
- @another_tag = ActsAsTaggableOn::Tag.create!(:name => "coo%")
121
- @another_tag2 = ActsAsTaggableOn::Tag.create!(:name => "coolish")
121
+ @another_tag = ActsAsTaggableOn::Tag.create!(:name => "coo%")
122
+ @another_tag2 = ActsAsTaggableOn::Tag.create!(:name => "coolish")
122
123
  end
123
-
124
+
124
125
  it "return escaped result when '%' char present in tag" do
125
- if @tag.using_sqlite?
126
- ActsAsTaggableOn::Tag.named_like('coo%').should include(@tag)
127
- ActsAsTaggableOn::Tag.named_like('coo%').should include(@another_tag)
128
- else
129
- ActsAsTaggableOn::Tag.named_like('coo%').should_not include(@tag)
126
+ ActsAsTaggableOn::Tag.named_like('coo%').should_not include(@tag)
130
127
  ActsAsTaggableOn::Tag.named_like('coo%').should include(@another_tag)
131
- end
132
128
  end
133
-
129
+
134
130
  end
135
131
  end