acts_as_votable 0.10.0 → 0.11.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -6
  3. data/.rubocop.yml +121 -0
  4. data/.travis.yml +12 -23
  5. data/Appraisals +13 -0
  6. data/Gemfile +3 -14
  7. data/README.markdown +80 -13
  8. data/Rakefile +6 -4
  9. data/acts_as_votable.gemspec +12 -5
  10. data/gemfiles/.bundle/config +2 -0
  11. data/gemfiles/rails_4.gemfile +7 -0
  12. data/gemfiles/rails_4.gemfile.lock +159 -0
  13. data/gemfiles/rails_5.gemfile +7 -0
  14. data/gemfiles/rails_5.gemfile.lock +166 -0
  15. data/gemfiles/rails_5_1.gemfile +7 -0
  16. data/gemfiles/rails_5_1.gemfile.lock +166 -0
  17. data/lib/acts_as_votable.rb +9 -9
  18. data/lib/acts_as_votable/cacheable.rb +174 -0
  19. data/lib/acts_as_votable/extenders/controller.rb +3 -4
  20. data/lib/acts_as_votable/extenders/votable.rb +17 -6
  21. data/lib/acts_as_votable/extenders/voter.rb +4 -6
  22. data/lib/acts_as_votable/helpers/words.rb +7 -10
  23. data/lib/acts_as_votable/version.rb +3 -1
  24. data/lib/acts_as_votable/votable.rb +50 -187
  25. data/lib/acts_as_votable/vote.rb +10 -12
  26. data/lib/acts_as_votable/voter.rb +52 -53
  27. data/lib/generators/acts_as_votable/migration/migration_generator.rb +19 -4
  28. data/lib/generators/acts_as_votable/migration/templates/active_record/{migration.rb → migration.erb} +1 -6
  29. data/spec/factories/votable.rb +6 -0
  30. data/spec/factories/votable_cache.rb +6 -0
  31. data/spec/factories/votable_cache_update_attributes.rb +6 -0
  32. data/spec/factories/votable_cache_update_columns.rb +6 -0
  33. data/spec/factories/votable_child_of_sti_not_votable.rb +6 -0
  34. data/spec/factories/votable_child_of_sti_votable.rb +6 -0
  35. data/spec/factories/votable_voter.rb +6 -0
  36. data/spec/factories/vote.rb +6 -0
  37. data/spec/factories/voter.rb +6 -0
  38. data/spec/generators/active_record_generator_spec.rb +13 -0
  39. data/spec/shared_example/votable_model.rb +506 -0
  40. data/spec/shared_example/voter_model.rb +280 -0
  41. data/spec/spec_helper.rb +28 -18
  42. data/spec/support/factory_girl.rb +10 -0
  43. data/spec/votable_spec.rb +10 -9
  44. data/spec/votable_voter_spec.rb +12 -12
  45. data/spec/voter_spec.rb +9 -10
  46. data/spec/words_spec.rb +9 -12
  47. metadata +98 -27
  48. data/spec/shared_example/votable_model_spec.rb +0 -421
  49. data/spec/shared_example/voter_model_spec.rb +0 -279
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "4.2.9"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,159 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ acts_as_votable (0.11.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionmailer (4.2.9)
10
+ actionpack (= 4.2.9)
11
+ actionview (= 4.2.9)
12
+ activejob (= 4.2.9)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ rails-dom-testing (~> 1.0, >= 1.0.5)
15
+ actionpack (4.2.9)
16
+ actionview (= 4.2.9)
17
+ activesupport (= 4.2.9)
18
+ rack (~> 1.6)
19
+ rack-test (~> 0.6.2)
20
+ rails-dom-testing (~> 1.0, >= 1.0.5)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (4.2.9)
23
+ activesupport (= 4.2.9)
24
+ builder (~> 3.1)
25
+ erubis (~> 2.7.0)
26
+ rails-dom-testing (~> 1.0, >= 1.0.5)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
28
+ activejob (4.2.9)
29
+ activesupport (= 4.2.9)
30
+ globalid (>= 0.3.0)
31
+ activemodel (4.2.9)
32
+ activesupport (= 4.2.9)
33
+ builder (~> 3.1)
34
+ activerecord (4.2.9)
35
+ activemodel (= 4.2.9)
36
+ activesupport (= 4.2.9)
37
+ arel (~> 6.0)
38
+ activesupport (4.2.9)
39
+ i18n (~> 0.7)
40
+ minitest (~> 5.1)
41
+ thread_safe (~> 0.3, >= 0.3.4)
42
+ tzinfo (~> 1.1)
43
+ appraisal (2.2.0)
44
+ bundler
45
+ rake
46
+ thor (>= 0.14.0)
47
+ arel (6.0.4)
48
+ ast (2.3.0)
49
+ builder (3.2.3)
50
+ concurrent-ruby (1.0.5)
51
+ diff-lcs (1.3)
52
+ docile (1.1.5)
53
+ erubis (2.7.0)
54
+ factory_girl (4.8.0)
55
+ activesupport (>= 3.0.0)
56
+ globalid (0.4.0)
57
+ activesupport (>= 4.2.0)
58
+ i18n (0.8.6)
59
+ json (2.1.0)
60
+ loofah (2.0.3)
61
+ nokogiri (>= 1.5.9)
62
+ mail (2.6.6)
63
+ mime-types (>= 1.16, < 4)
64
+ mime-types (3.1)
65
+ mime-types-data (~> 3.2015)
66
+ mime-types-data (3.2016.0521)
67
+ mini_portile2 (2.2.0)
68
+ minitest (5.10.3)
69
+ nokogiri (1.8.0)
70
+ mini_portile2 (~> 2.2.0)
71
+ parallel (1.12.0)
72
+ parser (2.4.0.0)
73
+ ast (~> 2.2)
74
+ powerpack (0.1.1)
75
+ rack (1.6.8)
76
+ rack-test (0.6.3)
77
+ rack (>= 1.0)
78
+ rails (4.2.9)
79
+ actionmailer (= 4.2.9)
80
+ actionpack (= 4.2.9)
81
+ actionview (= 4.2.9)
82
+ activejob (= 4.2.9)
83
+ activemodel (= 4.2.9)
84
+ activerecord (= 4.2.9)
85
+ activesupport (= 4.2.9)
86
+ bundler (>= 1.3.0, < 2.0)
87
+ railties (= 4.2.9)
88
+ sprockets-rails
89
+ rails-deprecated_sanitizer (1.0.3)
90
+ activesupport (>= 4.2.0.alpha)
91
+ rails-dom-testing (1.0.8)
92
+ activesupport (>= 4.2.0.beta, < 5.0)
93
+ nokogiri (~> 1.6)
94
+ rails-deprecated_sanitizer (>= 1.0.1)
95
+ rails-html-sanitizer (1.0.3)
96
+ loofah (~> 2.0)
97
+ railties (4.2.9)
98
+ actionpack (= 4.2.9)
99
+ activesupport (= 4.2.9)
100
+ rake (>= 0.8.7)
101
+ thor (>= 0.18.1, < 2.0)
102
+ rainbow (2.2.2)
103
+ rake
104
+ rake (12.0.0)
105
+ rspec (3.6.0)
106
+ rspec-core (~> 3.6.0)
107
+ rspec-expectations (~> 3.6.0)
108
+ rspec-mocks (~> 3.6.0)
109
+ rspec-core (3.6.0)
110
+ rspec-support (~> 3.6.0)
111
+ rspec-expectations (3.6.0)
112
+ diff-lcs (>= 1.2.0, < 2.0)
113
+ rspec-support (~> 3.6.0)
114
+ rspec-mocks (3.6.0)
115
+ diff-lcs (>= 1.2.0, < 2.0)
116
+ rspec-support (~> 3.6.0)
117
+ rspec-support (3.6.0)
118
+ rubocop (0.49.1)
119
+ parallel (~> 1.10)
120
+ parser (>= 2.3.3.1, < 3.0)
121
+ powerpack (~> 0.1)
122
+ rainbow (>= 1.99.1, < 3.0)
123
+ ruby-progressbar (~> 1.7)
124
+ unicode-display_width (~> 1.0, >= 1.0.1)
125
+ ruby-progressbar (1.8.1)
126
+ simplecov (0.15.0)
127
+ docile (~> 1.1.0)
128
+ json (>= 1.8, < 3)
129
+ simplecov-html (~> 0.10.0)
130
+ simplecov-html (0.10.2)
131
+ sprockets (3.7.1)
132
+ concurrent-ruby (~> 1.0)
133
+ rack (> 1, < 3)
134
+ sprockets-rails (3.2.0)
135
+ actionpack (>= 4.0)
136
+ activesupport (>= 4.0)
137
+ sprockets (>= 3.0.0)
138
+ sqlite3 (1.3.13)
139
+ thor (0.20.0)
140
+ thread_safe (0.3.6)
141
+ tzinfo (1.2.3)
142
+ thread_safe (~> 0.1)
143
+ unicode-display_width (1.3.0)
144
+
145
+ PLATFORMS
146
+ ruby
147
+
148
+ DEPENDENCIES
149
+ acts_as_votable!
150
+ appraisal (~> 2.2)
151
+ factory_girl (~> 4.8)
152
+ rails (= 4.2.9)
153
+ rspec (~> 3.6)
154
+ rubocop (~> 0.49.1)
155
+ simplecov (~> 0.15.0)
156
+ sqlite3 (~> 1.3)
157
+
158
+ BUNDLED WITH
159
+ 1.15.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.0.5"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,166 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ acts_as_votable (0.11.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (5.0.5)
10
+ actionpack (= 5.0.5)
11
+ nio4r (>= 1.2, < 3.0)
12
+ websocket-driver (~> 0.6.1)
13
+ actionmailer (5.0.5)
14
+ actionpack (= 5.0.5)
15
+ actionview (= 5.0.5)
16
+ activejob (= 5.0.5)
17
+ mail (~> 2.5, >= 2.5.4)
18
+ rails-dom-testing (~> 2.0)
19
+ actionpack (5.0.5)
20
+ actionview (= 5.0.5)
21
+ activesupport (= 5.0.5)
22
+ rack (~> 2.0)
23
+ rack-test (~> 0.6.3)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ actionview (5.0.5)
27
+ activesupport (= 5.0.5)
28
+ builder (~> 3.1)
29
+ erubis (~> 2.7.0)
30
+ rails-dom-testing (~> 2.0)
31
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
+ activejob (5.0.5)
33
+ activesupport (= 5.0.5)
34
+ globalid (>= 0.3.6)
35
+ activemodel (5.0.5)
36
+ activesupport (= 5.0.5)
37
+ activerecord (5.0.5)
38
+ activemodel (= 5.0.5)
39
+ activesupport (= 5.0.5)
40
+ arel (~> 7.0)
41
+ activesupport (5.0.5)
42
+ concurrent-ruby (~> 1.0, >= 1.0.2)
43
+ i18n (~> 0.7)
44
+ minitest (~> 5.1)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (7.1.4)
51
+ ast (2.3.0)
52
+ builder (3.2.3)
53
+ concurrent-ruby (1.0.5)
54
+ diff-lcs (1.3)
55
+ docile (1.1.5)
56
+ erubis (2.7.0)
57
+ factory_girl (4.8.0)
58
+ activesupport (>= 3.0.0)
59
+ globalid (0.4.0)
60
+ activesupport (>= 4.2.0)
61
+ i18n (0.8.6)
62
+ json (2.1.0)
63
+ loofah (2.0.3)
64
+ nokogiri (>= 1.5.9)
65
+ mail (2.6.6)
66
+ mime-types (>= 1.16, < 4)
67
+ method_source (0.8.2)
68
+ mime-types (3.1)
69
+ mime-types-data (~> 3.2015)
70
+ mime-types-data (3.2016.0521)
71
+ mini_portile2 (2.2.0)
72
+ minitest (5.10.3)
73
+ nio4r (2.1.0)
74
+ nokogiri (1.8.0)
75
+ mini_portile2 (~> 2.2.0)
76
+ parallel (1.12.0)
77
+ parser (2.4.0.0)
78
+ ast (~> 2.2)
79
+ powerpack (0.1.1)
80
+ rack (2.0.3)
81
+ rack-test (0.6.3)
82
+ rack (>= 1.0)
83
+ rails (5.0.5)
84
+ actioncable (= 5.0.5)
85
+ actionmailer (= 5.0.5)
86
+ actionpack (= 5.0.5)
87
+ actionview (= 5.0.5)
88
+ activejob (= 5.0.5)
89
+ activemodel (= 5.0.5)
90
+ activerecord (= 5.0.5)
91
+ activesupport (= 5.0.5)
92
+ bundler (>= 1.3.0)
93
+ railties (= 5.0.5)
94
+ sprockets-rails (>= 2.0.0)
95
+ rails-dom-testing (2.0.3)
96
+ activesupport (>= 4.2.0)
97
+ nokogiri (>= 1.6)
98
+ rails-html-sanitizer (1.0.3)
99
+ loofah (~> 2.0)
100
+ railties (5.0.5)
101
+ actionpack (= 5.0.5)
102
+ activesupport (= 5.0.5)
103
+ method_source
104
+ rake (>= 0.8.7)
105
+ thor (>= 0.18.1, < 2.0)
106
+ rainbow (2.2.2)
107
+ rake
108
+ rake (12.0.0)
109
+ rspec (3.6.0)
110
+ rspec-core (~> 3.6.0)
111
+ rspec-expectations (~> 3.6.0)
112
+ rspec-mocks (~> 3.6.0)
113
+ rspec-core (3.6.0)
114
+ rspec-support (~> 3.6.0)
115
+ rspec-expectations (3.6.0)
116
+ diff-lcs (>= 1.2.0, < 2.0)
117
+ rspec-support (~> 3.6.0)
118
+ rspec-mocks (3.6.0)
119
+ diff-lcs (>= 1.2.0, < 2.0)
120
+ rspec-support (~> 3.6.0)
121
+ rspec-support (3.6.0)
122
+ rubocop (0.49.1)
123
+ parallel (~> 1.10)
124
+ parser (>= 2.3.3.1, < 3.0)
125
+ powerpack (~> 0.1)
126
+ rainbow (>= 1.99.1, < 3.0)
127
+ ruby-progressbar (~> 1.7)
128
+ unicode-display_width (~> 1.0, >= 1.0.1)
129
+ ruby-progressbar (1.8.1)
130
+ simplecov (0.15.0)
131
+ docile (~> 1.1.0)
132
+ json (>= 1.8, < 3)
133
+ simplecov-html (~> 0.10.0)
134
+ simplecov-html (0.10.2)
135
+ sprockets (3.7.1)
136
+ concurrent-ruby (~> 1.0)
137
+ rack (> 1, < 3)
138
+ sprockets-rails (3.2.1)
139
+ actionpack (>= 4.0)
140
+ activesupport (>= 4.0)
141
+ sprockets (>= 3.0.0)
142
+ sqlite3 (1.3.13)
143
+ thor (0.20.0)
144
+ thread_safe (0.3.6)
145
+ tzinfo (1.2.3)
146
+ thread_safe (~> 0.1)
147
+ unicode-display_width (1.3.0)
148
+ websocket-driver (0.6.5)
149
+ websocket-extensions (>= 0.1.0)
150
+ websocket-extensions (0.1.2)
151
+
152
+ PLATFORMS
153
+ ruby
154
+
155
+ DEPENDENCIES
156
+ acts_as_votable!
157
+ appraisal (~> 2.2)
158
+ factory_girl (~> 4.8)
159
+ rails (= 5.0.5)
160
+ rspec (~> 3.6)
161
+ rubocop (~> 0.49.1)
162
+ simplecov (~> 0.15.0)
163
+ sqlite3 (~> 1.3)
164
+
165
+ BUNDLED WITH
166
+ 1.15.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.1.4"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,166 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ acts_as_votable (0.11.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actioncable (5.1.4)
10
+ actionpack (= 5.1.4)
11
+ nio4r (~> 2.0)
12
+ websocket-driver (~> 0.6.1)
13
+ actionmailer (5.1.4)
14
+ actionpack (= 5.1.4)
15
+ actionview (= 5.1.4)
16
+ activejob (= 5.1.4)
17
+ mail (~> 2.5, >= 2.5.4)
18
+ rails-dom-testing (~> 2.0)
19
+ actionpack (5.1.4)
20
+ actionview (= 5.1.4)
21
+ activesupport (= 5.1.4)
22
+ rack (~> 2.0)
23
+ rack-test (>= 0.6.3)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
+ actionview (5.1.4)
27
+ activesupport (= 5.1.4)
28
+ builder (~> 3.1)
29
+ erubi (~> 1.4)
30
+ rails-dom-testing (~> 2.0)
31
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
32
+ activejob (5.1.4)
33
+ activesupport (= 5.1.4)
34
+ globalid (>= 0.3.6)
35
+ activemodel (5.1.4)
36
+ activesupport (= 5.1.4)
37
+ activerecord (5.1.4)
38
+ activemodel (= 5.1.4)
39
+ activesupport (= 5.1.4)
40
+ arel (~> 8.0)
41
+ activesupport (5.1.4)
42
+ concurrent-ruby (~> 1.0, >= 1.0.2)
43
+ i18n (~> 0.7)
44
+ minitest (~> 5.1)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (8.0.0)
51
+ ast (2.3.0)
52
+ builder (3.2.3)
53
+ concurrent-ruby (1.0.5)
54
+ diff-lcs (1.3)
55
+ docile (1.1.5)
56
+ erubi (1.6.1)
57
+ factory_girl (4.8.0)
58
+ activesupport (>= 3.0.0)
59
+ globalid (0.4.0)
60
+ activesupport (>= 4.2.0)
61
+ i18n (0.8.6)
62
+ json (2.1.0)
63
+ loofah (2.0.3)
64
+ nokogiri (>= 1.5.9)
65
+ mail (2.6.6)
66
+ mime-types (>= 1.16, < 4)
67
+ method_source (0.8.2)
68
+ mime-types (3.1)
69
+ mime-types-data (~> 3.2015)
70
+ mime-types-data (3.2016.0521)
71
+ mini_portile2 (2.2.0)
72
+ minitest (5.10.3)
73
+ nio4r (2.1.0)
74
+ nokogiri (1.8.0)
75
+ mini_portile2 (~> 2.2.0)
76
+ parallel (1.12.0)
77
+ parser (2.4.0.0)
78
+ ast (~> 2.2)
79
+ powerpack (0.1.1)
80
+ rack (2.0.3)
81
+ rack-test (0.7.0)
82
+ rack (>= 1.0, < 3)
83
+ rails (5.1.4)
84
+ actioncable (= 5.1.4)
85
+ actionmailer (= 5.1.4)
86
+ actionpack (= 5.1.4)
87
+ actionview (= 5.1.4)
88
+ activejob (= 5.1.4)
89
+ activemodel (= 5.1.4)
90
+ activerecord (= 5.1.4)
91
+ activesupport (= 5.1.4)
92
+ bundler (>= 1.3.0)
93
+ railties (= 5.1.4)
94
+ sprockets-rails (>= 2.0.0)
95
+ rails-dom-testing (2.0.3)
96
+ activesupport (>= 4.2.0)
97
+ nokogiri (>= 1.6)
98
+ rails-html-sanitizer (1.0.3)
99
+ loofah (~> 2.0)
100
+ railties (5.1.4)
101
+ actionpack (= 5.1.4)
102
+ activesupport (= 5.1.4)
103
+ method_source
104
+ rake (>= 0.8.7)
105
+ thor (>= 0.18.1, < 2.0)
106
+ rainbow (2.2.2)
107
+ rake
108
+ rake (12.0.0)
109
+ rspec (3.6.0)
110
+ rspec-core (~> 3.6.0)
111
+ rspec-expectations (~> 3.6.0)
112
+ rspec-mocks (~> 3.6.0)
113
+ rspec-core (3.6.0)
114
+ rspec-support (~> 3.6.0)
115
+ rspec-expectations (3.6.0)
116
+ diff-lcs (>= 1.2.0, < 2.0)
117
+ rspec-support (~> 3.6.0)
118
+ rspec-mocks (3.6.0)
119
+ diff-lcs (>= 1.2.0, < 2.0)
120
+ rspec-support (~> 3.6.0)
121
+ rspec-support (3.6.0)
122
+ rubocop (0.49.1)
123
+ parallel (~> 1.10)
124
+ parser (>= 2.3.3.1, < 3.0)
125
+ powerpack (~> 0.1)
126
+ rainbow (>= 1.99.1, < 3.0)
127
+ ruby-progressbar (~> 1.7)
128
+ unicode-display_width (~> 1.0, >= 1.0.1)
129
+ ruby-progressbar (1.8.1)
130
+ simplecov (0.15.0)
131
+ docile (~> 1.1.0)
132
+ json (>= 1.8, < 3)
133
+ simplecov-html (~> 0.10.0)
134
+ simplecov-html (0.10.2)
135
+ sprockets (3.7.1)
136
+ concurrent-ruby (~> 1.0)
137
+ rack (> 1, < 3)
138
+ sprockets-rails (3.2.1)
139
+ actionpack (>= 4.0)
140
+ activesupport (>= 4.0)
141
+ sprockets (>= 3.0.0)
142
+ sqlite3 (1.3.13)
143
+ thor (0.20.0)
144
+ thread_safe (0.3.6)
145
+ tzinfo (1.2.3)
146
+ thread_safe (~> 0.1)
147
+ unicode-display_width (1.3.0)
148
+ websocket-driver (0.6.5)
149
+ websocket-extensions (>= 0.1.0)
150
+ websocket-extensions (0.1.2)
151
+
152
+ PLATFORMS
153
+ ruby
154
+
155
+ DEPENDENCIES
156
+ acts_as_votable!
157
+ appraisal (~> 2.2)
158
+ factory_girl (~> 4.8)
159
+ rails (= 5.1.4)
160
+ rspec (~> 3.6)
161
+ rubocop (~> 0.49.1)
162
+ simplecov (~> 0.15.0)
163
+ sqlite3 (~> 1.3)
164
+
165
+ BUNDLED WITH
166
+ 1.15.4