acts-as-taggable-on 12.0.0 → 13.0.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/acts-as-taggable-on/tag.rb +5 -13
  3. data/lib/acts-as-taggable-on/tag_list.rb +1 -1
  4. data/lib/acts-as-taggable-on/taggable/core.rb +0 -3
  5. data/lib/acts-as-taggable-on/taggable/tagged_with_query.rb +0 -5
  6. data/lib/acts-as-taggable-on/version.rb +1 -1
  7. data/lib/acts-as-taggable-on.rb +1 -1
  8. metadata +10 -170
  9. data/.github/workflows/spec.yml +0 -73
  10. data/.gitignore +0 -13
  11. data/.rspec +0 -2
  12. data/Appraisals +0 -23
  13. data/CHANGELOG.md +0 -379
  14. data/CONTRIBUTING.md +0 -57
  15. data/Gemfile +0 -11
  16. data/Guardfile +0 -5
  17. data/README.md +0 -596
  18. data/Rakefile +0 -21
  19. data/acts-as-taggable-on.gemspec +0 -32
  20. data/docker-compose.yml +0 -15
  21. data/gemfiles/activerecord_7.1.gemfile +0 -18
  22. data/gemfiles/activerecord_7.2.gemfile +0 -18
  23. data/gemfiles/activerecord_8.0.gemfile +0 -19
  24. data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +0 -272
  25. data/spec/acts_as_taggable_on/acts_as_tagger_spec.rb +0 -112
  26. data/spec/acts_as_taggable_on/caching_spec.rb +0 -125
  27. data/spec/acts_as_taggable_on/default_parser_spec.rb +0 -47
  28. data/spec/acts_as_taggable_on/dirty_spec.rb +0 -142
  29. data/spec/acts_as_taggable_on/generic_parser_spec.rb +0 -14
  30. data/spec/acts_as_taggable_on/related_spec.rb +0 -99
  31. data/spec/acts_as_taggable_on/single_table_inheritance_spec.rb +0 -231
  32. data/spec/acts_as_taggable_on/tag_list_spec.rb +0 -176
  33. data/spec/acts_as_taggable_on/tag_spec.rb +0 -398
  34. data/spec/acts_as_taggable_on/taggable_spec.rb +0 -828
  35. data/spec/acts_as_taggable_on/tagger_spec.rb +0 -153
  36. data/spec/acts_as_taggable_on/tagging_spec.rb +0 -169
  37. data/spec/acts_as_taggable_on/tags_helper_spec.rb +0 -45
  38. data/spec/acts_as_taggable_on/utils_spec.rb +0 -23
  39. data/spec/internal/app/models/altered_inheriting_taggable_model.rb +0 -5
  40. data/spec/internal/app/models/cached_model.rb +0 -3
  41. data/spec/internal/app/models/cached_model_with_array.rb +0 -11
  42. data/spec/internal/app/models/columns_override_model.rb +0 -5
  43. data/spec/internal/app/models/company.rb +0 -15
  44. data/spec/internal/app/models/inheriting_taggable_model.rb +0 -4
  45. data/spec/internal/app/models/market.rb +0 -2
  46. data/spec/internal/app/models/non_standard_id_taggable_model.rb +0 -8
  47. data/spec/internal/app/models/ordered_taggable_model.rb +0 -4
  48. data/spec/internal/app/models/other_cached_model.rb +0 -3
  49. data/spec/internal/app/models/other_taggable_model.rb +0 -4
  50. data/spec/internal/app/models/student.rb +0 -4
  51. data/spec/internal/app/models/taggable_model.rb +0 -16
  52. data/spec/internal/app/models/untaggable_model.rb +0 -3
  53. data/spec/internal/app/models/user.rb +0 -3
  54. data/spec/internal/config/database.yml.sample +0 -15
  55. data/spec/internal/db/schema.rb +0 -113
  56. data/spec/spec_helper.rb +0 -20
  57. data/spec/support/0-helpers.rb +0 -32
  58. data/spec/support/array.rb +0 -9
  59. data/spec/support/database.rb +0 -38
  60. data/spec/support/database_cleaner.rb +0 -25
@@ -1,153 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe 'Tagger' do
5
- before(:each) do
6
- @user = User.create
7
- @taggable = TaggableModel.create(name: 'Bob Jones')
8
- end
9
-
10
-
11
-
12
- it 'should have taggings' do
13
- @user.tag(@taggable, with: 'ruby,scheme', on: :tags)
14
- expect(@user.owned_taggings.size).to eq(2)
15
- end
16
-
17
- it 'should have tags' do
18
- @user.tag(@taggable, with: 'ruby,scheme', on: :tags)
19
- expect(@user.owned_tags.size).to eq(2)
20
- end
21
-
22
- it 'should scope objects returned by tagged_with by owners' do
23
- @taggable2 = TaggableModel.create(name: 'Jim Jones')
24
- @taggable3 = TaggableModel.create(name: 'Jane Doe')
25
-
26
- @user2 = User.new
27
- @user.tag(@taggable, with: 'ruby, scheme', on: :tags)
28
- @user2.tag(@taggable2, with: 'ruby, scheme', on: :tags)
29
- @user2.tag(@taggable3, with: 'ruby, scheme', on: :tags)
30
-
31
- expect(TaggableModel.tagged_with(%w(ruby scheme), owned_by: @user).count).to eq(1)
32
- expect(TaggableModel.tagged_with(%w(ruby scheme), owned_by: @user2).count).to eq(2)
33
- end
34
-
35
- it 'only returns objects tagged by owned_by when any is true' do
36
- @user2 = User.new
37
- @taggable2 = TaggableModel.create(name: 'Jim Jones')
38
- @taggable3 = TaggableModel.create(name: 'Jane Doe')
39
-
40
- @user.tag(@taggable, with: 'ruby', on: :tags)
41
- @user.tag(@taggable2, with: 'java', on: :tags)
42
- @user2.tag(@taggable3, with: 'ruby', on: :tags)
43
-
44
- tags = TaggableModel.tagged_with(%w(ruby java), owned_by: @user, any: true)
45
- expect(tags).to include(@taggable, @taggable2)
46
- expect(tags.size).to eq(2)
47
- end
48
-
49
- it 'only returns objects tagged by owned_by when exclude is true' do
50
- @user2 = User.new
51
- @taggable2 = TaggableModel.create(name: 'Jim Jones')
52
- @taggable3 = TaggableModel.create(name: 'Jane Doe')
53
-
54
- @user.tag(@taggable, with: 'ruby', on: :tags)
55
- @user.tag(@taggable2, with: 'java', on: :tags)
56
- @user2.tag(@taggable3, with: 'java', on: :tags)
57
-
58
- tags = TaggableModel.tagged_with(%w(ruby), owned_by: @user, exclude: true)
59
- expect(tags).to eq([@taggable2])
60
- end
61
-
62
- it 'should not overlap tags from different taggers' do
63
- @user2 = User.new
64
- expect {
65
- @user.tag(@taggable, with: 'ruby, scheme', on: :tags)
66
- @user2.tag(@taggable, with: 'java, python, lisp, ruby', on: :tags)
67
- }.to change(ActsAsTaggableOn::Tagging, :count).by(6)
68
-
69
- [@user, @user2, @taggable].each(&:reload)
70
-
71
- expect(@user.owned_tags.map(&:name).sort).to eq(%w(ruby scheme).sort)
72
- expect(@user2.owned_tags.map(&:name).sort).to eq(%w(java python lisp ruby).sort)
73
-
74
- expect(@taggable.tags_from(@user).sort).to eq(%w(ruby scheme).sort)
75
- expect(@taggable.tags_from(@user2).sort).to eq(%w(java lisp python ruby).sort)
76
-
77
- expect(@taggable.all_tags_list.sort).to eq(%w(ruby scheme java python lisp).sort)
78
- expect(@taggable.all_tags_on(:tags).size).to eq(5)
79
- end
80
-
81
- it 'should not lose tags from different taggers' do
82
- @user2 = User.create
83
- @user2.tag(@taggable, with: 'java, python, lisp, ruby', on: :tags)
84
- @user.tag(@taggable, with: 'ruby, scheme', on: :tags)
85
-
86
- expect {
87
- @user2.tag(@taggable, with: 'java, python, lisp', on: :tags)
88
- }.to change(ActsAsTaggableOn::Tagging, :count).by(-1)
89
-
90
- [@user, @user2, @taggable].each(&:reload)
91
-
92
- expect(@taggable.tags_from(@user).sort).to eq(%w(ruby scheme).sort)
93
- expect(@taggable.tags_from(@user2).sort).to eq(%w(java python lisp).sort)
94
-
95
- expect(@taggable.all_tags_list.sort).to eq(%w(ruby scheme java python lisp).sort)
96
- expect(@taggable.all_tags_on(:tags).length).to eq(5)
97
- end
98
-
99
- it 'should not lose tags' do
100
- @user2 = User.create
101
-
102
- @user.tag(@taggable, with: 'awesome', on: :tags)
103
- @user2.tag(@taggable, with: 'awesome, epic', on: :tags)
104
-
105
- expect {
106
- @user2.tag(@taggable, with: 'epic', on: :tags)
107
- }.to change(ActsAsTaggableOn::Tagging, :count).by(-1)
108
-
109
- @taggable.reload
110
- expect(@taggable.all_tags_list).to include('awesome')
111
- expect(@taggable.all_tags_list).to include('epic')
112
- end
113
-
114
- it 'should not lose tags' do
115
- @taggable.update(tag_list: 'ruby')
116
- @user.tag(@taggable, with: 'ruby, scheme', on: :tags)
117
-
118
- [@taggable, @user].each(&:reload)
119
- expect(@taggable.tag_list).to eq(%w(ruby))
120
- expect(@taggable.all_tags_list.sort).to eq(%w(ruby scheme).sort)
121
-
122
- expect {
123
- @taggable.update(tag_list: '')
124
- }.to change(ActsAsTaggableOn::Tagging, :count).by(-1)
125
-
126
- expect(@taggable.tag_list).to be_empty
127
- expect(@taggable.all_tags_list.sort).to eq(%w(ruby scheme).sort)
128
- end
129
-
130
- it 'is tagger' do
131
- expect(@user.is_tagger?).to be_truthy
132
- end
133
-
134
- it 'should skip save if skip_save is passed as option' do
135
- expect(-> {
136
- @user.tag(@taggable, with: 'epic', on: :tags, skip_save: true)
137
- }).to_not change(ActsAsTaggableOn::Tagging, :count)
138
- end
139
-
140
- it 'should change tags order in ordered taggable' do
141
- @ordered_taggable = OrderedTaggableModel.create name: 'hey!'
142
-
143
- @user.tag @ordered_taggable, with: 'tag, tag1', on: :tags
144
- expect(@ordered_taggable.reload.tags_from(@user)).to eq(['tag', 'tag1'])
145
-
146
- @user.tag @ordered_taggable, with: 'tag2, tag1', on: :tags
147
- expect(@ordered_taggable.reload.tags_from(@user)).to eq(['tag2', 'tag1'])
148
-
149
- @user.tag @ordered_taggable, with: 'tag1, tag2', on: :tags
150
- expect(@ordered_taggable.reload.tags_from(@user)).to eq(['tag1', 'tag2'])
151
- end
152
-
153
- end
@@ -1,169 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe ActsAsTaggableOn::Tagging do
5
- before(:each) do
6
- @tagging = ActsAsTaggableOn::Tagging.new
7
- end
8
-
9
- it 'should not be valid with a invalid tag' do
10
- @tagging.taggable = TaggableModel.create(name: 'Bob Jones')
11
- @tagging.tag = ActsAsTaggableOn::Tag.new(name: '')
12
- @tagging.context = 'tags'
13
-
14
- expect(@tagging).to_not be_valid
15
-
16
- expect(@tagging.errors[:tag_id]).to eq(['can\'t be blank'])
17
- end
18
-
19
- it 'should not create duplicate taggings' do
20
- @taggable = TaggableModel.create(name: 'Bob Jones')
21
- @tag = ActsAsTaggableOn::Tag.create(name: 'awesome')
22
-
23
- expect {
24
- 2.times { ActsAsTaggableOn::Tagging.create(taggable: @taggable, tag: @tag, context: 'tags') }
25
- }.to change(ActsAsTaggableOn::Tagging, :count).by(1)
26
- end
27
-
28
- it 'should not delete tags of other records' do
29
- 6.times { TaggableModel.create(name: 'Bob Jones', tag_list: 'very, serious, bug') }
30
- expect(ActsAsTaggableOn::Tag.count).to eq(3)
31
- taggable = TaggableModel.first
32
- taggable.tag_list = 'bug'
33
- taggable.save
34
-
35
- expect(taggable.tag_list).to eq(['bug'])
36
-
37
- another_taggable = TaggableModel.where('id != ?', taggable.id).sample
38
- expect(another_taggable.tag_list.sort).to eq(%w(very serious bug).sort)
39
- end
40
-
41
- it 'should destroy unused tags after tagging destroyed' do
42
- previous_setting = ActsAsTaggableOn.remove_unused_tags
43
- ActsAsTaggableOn.remove_unused_tags = true
44
- ActsAsTaggableOn::Tag.destroy_all
45
- @taggable = TaggableModel.create(name: 'Bob Jones')
46
- @taggable.update_attribute :tag_list, 'aaa,bbb,ccc'
47
- @taggable.update_attribute :tag_list, ''
48
- expect(ActsAsTaggableOn::Tag.count).to eql(0)
49
- ActsAsTaggableOn.remove_unused_tags = previous_setting
50
- end
51
-
52
- it 'should destroy unused tags after tagging destroyed when not using tags_counter' do
53
- remove_unused_tags_previous_setting = ActsAsTaggableOn.remove_unused_tags
54
- tags_counter_previous_setting = ActsAsTaggableOn.tags_counter
55
- ActsAsTaggableOn.remove_unused_tags = true
56
- ActsAsTaggableOn.tags_counter = false
57
-
58
- ActsAsTaggableOn::Tag.destroy_all
59
- @taggable = TaggableModel.create(name: 'Bob Jones')
60
- @taggable.update_attribute :tag_list, 'aaa,bbb,ccc'
61
- @taggable.update_attribute :tag_list, ''
62
- expect(ActsAsTaggableOn::Tag.count).to eql(0)
63
-
64
- ActsAsTaggableOn.remove_unused_tags = remove_unused_tags_previous_setting
65
- ActsAsTaggableOn.tags_counter = tags_counter_previous_setting
66
- end
67
-
68
- describe 'context scopes' do
69
- before do
70
- @tagging_2 = ActsAsTaggableOn::Tagging.new
71
- @tagging_3 = ActsAsTaggableOn::Tagging.new
72
-
73
- @tagger = User.new
74
- @tagger_2 = User.new
75
-
76
- @tagging.taggable = TaggableModel.create(name: "Black holes")
77
- @tagging.tag = ActsAsTaggableOn::Tag.create(name: "Physics")
78
- @tagging.tagger = @tagger
79
- @tagging.context = 'Science'
80
- @tagging.tenant = 'account1'
81
- @tagging.save
82
-
83
- @tagging_2.taggable = TaggableModel.create(name: "Satellites")
84
- @tagging_2.tag = ActsAsTaggableOn::Tag.create(name: "Technology")
85
- @tagging_2.tagger = @tagger_2
86
- @tagging_2.context = 'Science'
87
- @tagging_2.tenant = 'account1'
88
- @tagging_2.save
89
-
90
- @tagging_3.taggable = TaggableModel.create(name: "Satellites")
91
- @tagging_3.tag = ActsAsTaggableOn::Tag.create(name: "Engineering")
92
- @tagging_3.tagger = @tagger_2
93
- @tagging_3.context = 'Astronomy'
94
- @tagging_3.save
95
-
96
- end
97
-
98
- describe '.owned_by' do
99
- it "should belong to a specific user" do
100
- expect(ActsAsTaggableOn::Tagging.owned_by(@tagger).first).to eq(@tagging)
101
- end
102
- end
103
-
104
- describe '.by_context' do
105
- it "should be found by context" do
106
- expect(ActsAsTaggableOn::Tagging.by_context('Science').length).to eq(2);
107
- end
108
- end
109
-
110
- describe '.by_contexts' do
111
- it "should find taggings by contexts" do
112
- expect(ActsAsTaggableOn::Tagging.by_contexts(['Science', 'Astronomy']).first).to eq(@tagging);
113
- expect(ActsAsTaggableOn::Tagging.by_contexts(['Science', 'Astronomy']).second).to eq(@tagging_2);
114
- expect(ActsAsTaggableOn::Tagging.by_contexts(['Science', 'Astronomy']).third).to eq(@tagging_3);
115
- expect(ActsAsTaggableOn::Tagging.by_contexts(['Science', 'Astronomy']).length).to eq(3);
116
- end
117
- end
118
-
119
- describe '.by_tenant' do
120
- it "should find taggings by tenant" do
121
- expect(ActsAsTaggableOn::Tagging.by_tenant('account1').length).to eq(2);
122
- expect(ActsAsTaggableOn::Tagging.by_tenant('account1').first).to eq(@tagging);
123
- expect(ActsAsTaggableOn::Tagging.by_tenant('account1').second).to eq(@tagging_2);
124
- end
125
- end
126
-
127
- describe '.not_owned' do
128
- before do
129
- @tagging_4 = ActsAsTaggableOn::Tagging.new
130
- @tagging_4.taggable = TaggableModel.create(name: "Gravity")
131
- @tagging_4.tag = ActsAsTaggableOn::Tag.create(name: "Space")
132
- @tagging_4.context = "Science"
133
- @tagging_4.save
134
- end
135
-
136
- it "should found the taggings that do not have owner" do
137
- expect(ActsAsTaggableOn::Tagging.all.length).to eq(4)
138
- expect(ActsAsTaggableOn::Tagging.not_owned.length).to eq(1)
139
- expect(ActsAsTaggableOn::Tagging.not_owned.first).to eq(@tagging_4)
140
- end
141
- end
142
- end
143
-
144
- describe 'base_class' do
145
- before do
146
- class Foo < ActiveRecord::Base; end
147
- end
148
-
149
- context "default" do
150
- it "inherits from ActiveRecord::Base" do
151
-
152
- expect(ActsAsTaggableOn::Tagging.ancestors).to include(ActiveRecord::Base)
153
- expect(ActsAsTaggableOn::Tagging.ancestors).to_not include(Foo)
154
- end
155
- end
156
-
157
- context "custom" do
158
- it "inherits from custom class" do
159
-
160
- ActsAsTaggableOn.base_class = 'Foo'
161
- hide_const("ActsAsTaggableOn::Tagging")
162
- load("lib/acts-as-taggable-on/tagging.rb")
163
-
164
- expect(ActsAsTaggableOn::Tagging.ancestors).to include(Foo)
165
- end
166
- end
167
- end
168
-
169
- end
@@ -1,45 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe ActsAsTaggableOn::TagsHelper do
5
- before(:each) do
6
- @bob = TaggableModel.create(name: 'Bob Jones', language_list: 'ruby, php')
7
- @tom = TaggableModel.create(name: 'Tom Marley', language_list: 'ruby, java')
8
- @eve = TaggableModel.create(name: 'Eve Nodd', language_list: 'ruby, c++')
9
-
10
- @helper =
11
- class Helper
12
- include ActsAsTaggableOn::TagsHelper
13
- end.new
14
- end
15
-
16
-
17
- it 'should yield the proper css classes' do
18
- tags = {}
19
-
20
- @helper.tag_cloud(TaggableModel.tag_counts_on(:languages), %w(sucky awesome)) do |tag, css_class|
21
- tags[tag.name] = css_class
22
- end
23
-
24
- expect(tags['ruby']).to eq('awesome')
25
- expect(tags['java']).to eq('sucky')
26
- expect(tags['c++']).to eq('sucky')
27
- expect(tags['php']).to eq('sucky')
28
- end
29
-
30
- it 'should handle tags with zero counts (build for empty)' do
31
- ActsAsTaggableOn::Tag.create(name: 'php')
32
- ActsAsTaggableOn::Tag.create(name: 'java')
33
- ActsAsTaggableOn::Tag.create(name: 'c++')
34
-
35
- tags = {}
36
-
37
- @helper.tag_cloud(ActsAsTaggableOn::Tag.all, %w(sucky awesome)) do |tag, css_class|
38
- tags[tag.name] = css_class
39
- end
40
-
41
- expect(tags['java']).to eq('sucky')
42
- expect(tags['c++']).to eq('sucky')
43
- expect(tags['php']).to eq('sucky')
44
- end
45
- end
@@ -1,23 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe ActsAsTaggableOn::Utils do
5
- describe '#like_operator' do
6
- it 'should return \'ILIKE\' when the adapter is PostgreSQL' do
7
- allow(ActsAsTaggableOn::Utils.connection).to receive(:adapter_name) { 'PostgreSQL' }
8
- expect(ActsAsTaggableOn::Utils.like_operator).to eq('ILIKE')
9
- end
10
-
11
- it 'should return \'LIKE\' when the adapter is not PostgreSQL' do
12
- allow(ActsAsTaggableOn::Utils.connection).to receive(:adapter_name) { 'MySQL' }
13
- expect(ActsAsTaggableOn::Utils.like_operator).to eq('LIKE')
14
- end
15
- end
16
-
17
- describe '#sha_prefix' do
18
- it 'should return a consistent prefix for a given word' do
19
- expect(ActsAsTaggableOn::Utils.sha_prefix('kittens')).to eq(ActsAsTaggableOn::Utils.sha_prefix('kittens'))
20
- expect(ActsAsTaggableOn::Utils.sha_prefix('puppies')).not_to eq(ActsAsTaggableOn::Utils.sha_prefix('kittens'))
21
- end
22
- end
23
- end
@@ -1,5 +0,0 @@
1
- require_relative 'taggable_model'
2
-
3
- class AlteredInheritingTaggableModel < TaggableModel
4
- acts_as_taggable_on :parts
5
- end
@@ -1,3 +0,0 @@
1
- class CachedModel < ActiveRecord::Base
2
- acts_as_taggable
3
- end
@@ -1,11 +0,0 @@
1
- if using_postgresql?
2
- class CachedModelWithArray < ActiveRecord::Base
3
- acts_as_taggable
4
- end
5
- if postgresql_support_json?
6
- class TaggableModelWithJson < ActiveRecord::Base
7
- acts_as_taggable
8
- acts_as_taggable_on :skills
9
- end
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- class ColumnsOverrideModel < ActiveRecord::Base
2
- def self.columns
3
- super.reject { |c| c.name == 'ignored_column' }
4
- end
5
- end
@@ -1,15 +0,0 @@
1
- class Company < ActiveRecord::Base
2
- acts_as_taggable_on :locations, :markets
3
-
4
- has_many :markets, :through => :market_taggings, :source => :tag
5
-
6
- private
7
-
8
- def find_or_create_tags_from_list_with_context(tag_list, context)
9
- if context.to_sym == :markets
10
- Market.find_or_create_all_with_like_by_name(tag_list)
11
- else
12
- super
13
- end
14
- end
15
- end
@@ -1,4 +0,0 @@
1
- require_relative 'taggable_model'
2
-
3
- class InheritingTaggableModel < TaggableModel
4
- end
@@ -1,2 +0,0 @@
1
- class Market < ActsAsTaggableOn::Tag
2
- end
@@ -1,8 +0,0 @@
1
- class NonStandardIdTaggableModel < ActiveRecord::Base
2
- self.primary_key = :an_id
3
- acts_as_taggable
4
- acts_as_taggable_on :languages
5
- acts_as_taggable_on :skills
6
- acts_as_taggable_on :needs, :offerings
7
- has_many :untaggable_models
8
- end
@@ -1,4 +0,0 @@
1
- class OrderedTaggableModel < ActiveRecord::Base
2
- acts_as_ordered_taggable
3
- acts_as_ordered_taggable_on :colours
4
- end
@@ -1,3 +0,0 @@
1
- class OtherCachedModel < ActiveRecord::Base
2
- acts_as_taggable_on :languages, :statuses, :glasses
3
- end
@@ -1,4 +0,0 @@
1
- class OtherTaggableModel < ActiveRecord::Base
2
- acts_as_taggable_on :tags, :languages
3
- acts_as_taggable_on :needs, :offerings
4
- end
@@ -1,4 +0,0 @@
1
- require_relative 'user'
2
-
3
- class Student < User
4
- end
@@ -1,16 +0,0 @@
1
- class TaggableModel < ActiveRecord::Base
2
- acts_as_taggable
3
- acts_as_taggable_on :languages
4
- acts_as_taggable_on :skills
5
- acts_as_taggable_on :needs, :offerings
6
- acts_as_taggable_tenant :tenant_id
7
-
8
- has_many :untaggable_models
9
-
10
- attr_reader :tag_list_submethod_called
11
-
12
- def tag_list=(v)
13
- @tag_list_submethod_called = true
14
- super
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- class UntaggableModel < ActiveRecord::Base
2
- belongs_to :taggable_model
3
- end
@@ -1,3 +0,0 @@
1
- class User < ActiveRecord::Base
2
- acts_as_tagger
3
- end
@@ -1,15 +0,0 @@
1
- sqlite3:
2
- adapter: sqlite3
3
- database: ':memory:'
4
-
5
- mysql:
6
- adapter: mysql2
7
- host: 127.0.0.1
8
- username: root
9
- password:
10
- database: acts_as_taggable_on
11
- encoding: utf8
12
-
13
- postgresql:
14
- # Needs to be given as a URL to force connection via TCP
15
- url: postgresql://postgres:postgres@127.0.0.1:5432/acts_as_taggable_on?encoding=utf8
@@ -1,113 +0,0 @@
1
- ActiveRecord::Schema.define version: 0 do
2
- create_table ActsAsTaggableOn.tags_table, force: true do |t|
3
- t.string :name
4
- t.integer :taggings_count, default: 0
5
- t.string :type
6
- end
7
- add_index ActsAsTaggableOn.tags_table, ['name'], name: 'index_tags_on_name', unique: true
8
-
9
- create_table ActsAsTaggableOn.taggings_table, force: true do |t|
10
- t.integer :tag_id
11
-
12
- # You should make sure that the column created is
13
- # long enough to store the required class names.
14
- t.string :taggable_type
15
- t.integer :taggable_id
16
-
17
- t.string :tagger_type
18
- t.integer :tagger_id
19
-
20
- # Limit is created to prevent MySQL error on index
21
- # length for MyISAM table type: http://bit.ly/vgW2Ql
22
- t.string :context, limit: 128
23
-
24
- t.string :tenant , limit: 128
25
-
26
- t.datetime :created_at
27
- end
28
- add_index ActsAsTaggableOn.taggings_table,
29
- ['tag_id', 'taggable_id', 'taggable_type', 'context', 'tagger_id', 'tagger_type'],
30
- unique: true, name: 'taggings_idx'
31
- add_index ActsAsTaggableOn.taggings_table, :tag_id , name: 'index_taggings_on_tag_id'
32
-
33
- # above copied from
34
- # generators/acts_as_taggable_on/migration/migration_generator
35
-
36
- create_table :taggable_models, force: true do |t|
37
- t.column :name, :string
38
- t.column :type, :string
39
- t.column :tenant_id, :integer
40
- end
41
-
42
- create_table :columns_override_models, force: true do |t|
43
- t.column :name, :string
44
- t.column :type, :string
45
- t.column :ignored_column, :string
46
- end
47
-
48
- create_table :non_standard_id_taggable_models, primary_key: 'an_id', force: true do |t|
49
- t.column :name, :string
50
- t.column :type, :string
51
- end
52
-
53
- create_table :untaggable_models, force: true do |t|
54
- t.column :taggable_model_id, :integer
55
- t.column :name, :string
56
- end
57
-
58
- create_table :cached_models, force: true do |t|
59
- t.column :name, :string
60
- t.column :type, :string
61
- t.column :cached_tag_list, :string
62
- end
63
-
64
- create_table :other_cached_models, force: true do |t|
65
- t.column :name, :string
66
- t.column :type, :string
67
- t.column :cached_language_list, :string
68
- t.column :cached_status_list, :string
69
- t.column :cached_glass_list, :string
70
- end
71
-
72
- create_table :companies, force: true do |t|
73
- t.column :name, :string
74
- end
75
-
76
- create_table :users, force: true do |t|
77
- t.column :name, :string
78
- end
79
-
80
- create_table :other_taggable_models, force: true do |t|
81
- t.column :name, :string
82
- t.column :type, :string
83
- end
84
-
85
- create_table :ordered_taggable_models, force: true do |t|
86
- t.column :name, :string
87
- t.column :type, :string
88
- end
89
-
90
- create_table :cache_methods_injected_models, force: true do |t|
91
- t.column :cached_tag_list, :string
92
- end
93
-
94
- # Special cases for postgresql
95
- if using_postgresql?
96
-
97
- create_table :other_cached_with_array_models, force: true do |t|
98
- t.column :name, :string
99
- t.column :type, :string
100
- t.column :cached_language_list, :string, array: true
101
- t.column :cached_status_list, :string, array: true
102
- t.column :cached_glass_list, :string, array: true
103
- end
104
-
105
- if postgresql_support_json?
106
- create_table :taggable_model_with_jsons, :force => true do |t|
107
- t.column :name, :string
108
- t.column :type, :string
109
- t.column :opts, :json
110
- end
111
- end
112
- end
113
- end
data/spec/spec_helper.rb DELETED
@@ -1,20 +0,0 @@
1
- begin
2
- require 'byebug'
3
- rescue LoadError
4
- end
5
- $LOAD_PATH << '.' unless $LOAD_PATH.include?('.')
6
- $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
7
- require 'logger'
8
-
9
- require File.expand_path('../../lib/acts-as-taggable-on', __FILE__)
10
- I18n.enforce_available_locales = true
11
- require 'rails'
12
- require 'rspec/its'
13
- require 'barrier'
14
- require 'database_cleaner'
15
-
16
- Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
17
-
18
- RSpec.configure do |config|
19
- config.raise_errors_for_deprecations!
20
- end