acts_as_votable 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5fca81cb1bf31ad9968d28f93e0ed7f9c786572
4
- data.tar.gz: ccfa03e8e8679fb0cabaf0f8817771b89edd6d30
3
+ metadata.gz: 258ed9d5171cee8f3a41d52f1895e11ebc3ed486
4
+ data.tar.gz: 4a291c5c9a5b370f83525e050a20807a8730d8d2
5
5
  SHA512:
6
- metadata.gz: 592d2a30798bf898d32a5a9bc6b343b6eb424f57d62769fa6b52e839f300a6be176b12b3ca013a8639d24090f1109b86f16c5fec905a8731343ce3dedb8975e1
7
- data.tar.gz: 649a8cb5caa0a4e03fb8f17be3cc6270bc7bc3e0a0878fb59e97c087c36239b5268645cf20eb063a2202cb17164b00dc1f8ae97510703eee43c08333ec3d30da
6
+ metadata.gz: b98afcd423073489cc548d87b0c941d792f697e789b87471eef7b82bc96b2e8d6c6d5cc68ff431942a9bc9c7ba6c242557f6b244ee3eef98168bb1df8f2c4846
7
+ data.tar.gz: 5f9e29f5e7208a21293cf20122c2d8291064a4ea99e15fd499ae207b98e6e9f9ff0d0694fcb54a1ebeb339fee1526041691657685037016fea6258a01f697563
data/.gitignore CHANGED
@@ -1,6 +1,7 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
3
  /Gemfile.lock
4
+ /gemfiles/*.gemfile.lock
4
5
  /_yardoc/
5
6
  /coverage/
6
7
  /doc/
@@ -3,12 +3,16 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.2.7
7
6
  - 2.3.4
8
- - 2.4.1
7
+ - 2.4.2
8
+ - 2.5.1
9
+
10
+ before_install:
11
+ - gem update --system
9
12
 
10
13
  gemfile:
11
14
  - gemfiles/rails_4.gemfile
12
15
  - gemfiles/rails_5.gemfile
13
16
  - gemfiles/rails_5_1.gemfile
17
+ - gemfiles/rails_5_2.gemfile
14
18
 
data/Appraisals CHANGED
@@ -1,13 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  appraise "rails-4" do
4
- gem "rails", "4.2.9"
4
+ gem "rails", "4.2.10"
5
5
  end
6
6
 
7
7
  appraise "rails-5" do
8
- gem "rails", "5.0.5"
8
+ gem "rails", "5.0.6"
9
9
  end
10
10
 
11
11
  appraise "rails-5-1" do
12
12
  gem "rails", "5.1.4"
13
13
  end
14
+
15
+ appraise "rails-5-2" do
16
+ gem "rails", "5.2.0"
17
+ end
@@ -1,6 +1,6 @@
1
1
  # Acts As Votable (aka Acts As Likeable)
2
2
 
3
- [![Build Status](https://travis-ci.org/ryanto/acts_as_votable.png)](https://travis-ci.org/ryanto/acts_as_votable)
3
+ [![Build Status](https://travis-ci.org/ryanto/acts_as_votable.svg?branch=master)](https://travis-ci.org/ryanto/acts_as_votable)
4
4
  [![Code Climate](https://codeclimate.com/github/ryanto/acts_as_votable.png)](https://codeclimate.com/github/ryanto/acts_as_votable)
5
5
 
6
6
  Acts As Votable is a Ruby Gem specifically written for Rails/ActiveRecord models.
@@ -16,16 +16,15 @@ The main goals of this gem are:
16
16
 
17
17
  ### Supported Ruby and Rails versions
18
18
 
19
- * Ruby 2.2.0, 2.3.0 and 2.4.0
20
- * Rails 4.0, 4.1+
21
- * Rails 5.0, 5.1
19
+ * Ruby >= 2.3.0
20
+ * Rails >= 4
22
21
 
23
22
  ### Install
24
23
 
25
24
  Just add the following to your Gemfile to install the latest release.
26
25
 
27
26
  ```ruby
28
- gem 'acts_as_votable', '~> 0.10.0'
27
+ gem 'acts_as_votable', '~> 0.12.0'
29
28
  ```
30
29
 
31
30
  And follow that up with a ``bundle install``.
@@ -312,35 +311,20 @@ to speed up @post we would use the following migration:
312
311
 
313
312
  ```ruby
314
313
  class AddCachedVotesToPosts < ActiveRecord::Migration
315
- def self.up
316
- add_column :posts, :cached_votes_total, :integer, :default => 0
317
- add_column :posts, :cached_votes_score, :integer, :default => 0
318
- add_column :posts, :cached_votes_up, :integer, :default => 0
319
- add_column :posts, :cached_votes_down, :integer, :default => 0
320
- add_column :posts, :cached_weighted_score, :integer, :default => 0
321
- add_column :posts, :cached_weighted_total, :integer, :default => 0
322
- add_column :posts, :cached_weighted_average, :float, :default => 0.0
323
- add_index :posts, :cached_votes_total
324
- add_index :posts, :cached_votes_score
325
- add_index :posts, :cached_votes_up
326
- add_index :posts, :cached_votes_down
327
- add_index :posts, :cached_weighted_score
328
- add_index :posts, :cached_weighted_total
329
- add_index :posts, :cached_weighted_average
314
+ def change
315
+ change_table :posts do |t|
316
+ t.integer :cached_votes_total, default: 0
317
+ t.integer :cached_votes_score, default: 0
318
+ t.integer :cached_votes_up, default: 0
319
+ t.integer :cached_votes_down, default: 0
320
+ t.integer :cached_weighted_score, default: 0
321
+ t.integer :cached_weighted_total, default: 0
322
+ t.float :cached_weighted_average, default: 0.0
323
+ end
330
324
 
331
325
  # Uncomment this line to force caching of existing votes
332
326
  # Post.find_each(&:update_cached_votes)
333
327
  end
334
-
335
- def self.down
336
- remove_column :posts, :cached_votes_total
337
- remove_column :posts, :cached_votes_score
338
- remove_column :posts, :cached_votes_up
339
- remove_column :posts, :cached_votes_down
340
- remove_column :posts, :cached_weighted_score
341
- remove_column :posts, :cached_weighted_total
342
- remove_column :posts, :cached_weighted_average
343
- end
344
328
  end
345
329
  ```
346
330
 
@@ -348,36 +332,21 @@ If you have a scope for your vote, let's say `subscribe`, your migration will be
348
332
 
349
333
  ```ruby
350
334
  class AddCachedVotesToPosts < ActiveRecord::Migration
351
- def self.up
352
- add_column :posts, :cached_scoped_subscribe_votes_total, :integer, :default => 0
353
- add_column :posts, :cached_scoped_subscribe_votes_score, :integer, :default => 0
354
- add_column :posts, :cached_scoped_subscribe_votes_up, :integer, :default => 0
355
- add_column :posts, :cached_scoped_subscribe_votes_down, :integer, :default => 0
356
- add_column :posts, :cached_weighted_subscribe_score, :integer, :default => 0
357
- add_column :posts, :cached_weighted_subscribe_total, :integer, :default => 0
358
- add_column :posts, :cached_weighted_subscribe_average, :float, :default => 0.0
359
- add_index :posts, :cached_scoped_subscribe_votes_total
360
- add_index :posts, :cached_scoped_subscribe_votes_score
361
- add_index :posts, :cached_scoped_subscribe_votes_up
362
- add_index :posts, :cached_scoped_subscribe_votes_down
363
- add_index :posts, :cached_weighted_subscribe_score
364
- add_index :posts, :cached_weighted_subscribe_total
365
- add_index :posts, :cached_weighted_subscribe_average
366
- end
367
-
368
- def self.down
369
- remove_column :posts, :cached_scoped_subscribe_votes_total
370
- remove_column :posts, :cached_scoped_subscribe_votes_score
371
- remove_column :posts, :cached_scoped_subscribe_votes_up
372
- remove_column :posts, :cached_scoped_subscribe_votes_down
373
- remove_column :posts, :cached_weighted_subscribe_score
374
- remove_column :posts, :cached_weighted_subscribe_total
375
- remove_column :posts, :cached_weighted_subscribe_average
335
+ def change
336
+ change_table :posts do |t|
337
+ t.integer :cached_scoped_subscribe_votes_total, default: 0
338
+ t.integer :cached_scoped_subscribe_votes_score, default: 0
339
+ t.integer :cached_scoped_subscribe_votes_up, default: 0
340
+ t.integer :cached_scoped_subscribe_votes_down, default: 0
341
+ t.integer :cached_weighted_subscribe_score, default: 0
342
+ t.integer :cached_weighted_subscribe_total, default: 0
343
+ t.float :cached_weighted_subscribe_average, default: 0.0
344
+ end
376
345
  end
377
346
  end
378
347
  ```
379
348
 
380
- `cached_weighted_average` can be helpful for a rating system, e.g.:
349
+ `cached_weighted_average` can be helpful for a rating system, e.g.:
381
350
 
382
351
  Order by average rating:
383
352
 
@@ -416,20 +385,20 @@ They can be run with:
416
385
  rake spec
417
386
  ```
418
387
 
419
- ## Changes
388
+ ## Changes
420
389
 
421
- ### Fixes for votable voter model
390
+ ### Fixes for votable voter model
422
391
 
423
- In version 0.8.0, there are bugs for a model that is both votable and voter.
392
+ In version 0.8.0, there are bugs for a model that is both votable and voter.
424
393
  Some name-conflicting methods are renamed:
425
- + Renamed Votable.votes to votes_for
394
+ + Renamed Votable.votes to votes_for
426
395
  + Renamed Votable.vote to vote_by,
427
396
  + Removed Votable.vote_by alias (was an alias for :vote_up)
428
397
  + Renamed Votable.unvote_for to unvote_by
429
398
  + Renamed Votable.find_votes to find_votes_for
430
- + Renamed Votable.up_votes to get_upvotes
399
+ + Renamed Votable.up_votes to get_upvotes
431
400
  + and its aliases :get_true_votes, :get_ups, :get_upvotes, :get_likes, :get_positives, :get_for_votes
432
- + Renamed Votable.down_votes to get_downvotes
401
+ + Renamed Votable.down_votes to get_downvotes
433
402
  + and its aliases :get_false_votes, :get_downs, :get_downvotes, :get_dislikes, :get_negatives
434
403
 
435
404
 
@@ -27,5 +27,5 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "rubocop", "~> 0.49.1"
28
28
  s.add_development_dependency "simplecov", "~> 0.15.0"
29
29
  s.add_development_dependency "appraisal", "~> 2.2"
30
- s.add_development_dependency "factory_girl", "~> 4.8"
30
+ s.add_development_dependency "factory_bot", "~> 4.8"
31
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.2.9"
5
+ gem "rails", "4.2.10"
6
6
 
7
7
  gemspec path: "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "5.0.5"
5
+ gem "rails", "5.0.6"
6
6
 
7
7
  gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.2.0"
6
+
7
+ gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActsAsVotable
4
- VERSION = "0.11.1"
4
+ VERSION = "0.12.0"
5
5
  end
@@ -65,23 +65,16 @@ module ActsAsVotable
65
65
 
66
66
  # voting
67
67
  def vote_by(args = {})
68
- options = {
69
- vote: true,
70
- vote_scope: nil
71
- }.merge(args)
68
+ return false if args[:voter].nil?
72
69
 
73
- self.vote_registered = false
70
+ options = { vote: true, vote_scope: nil }.merge(args)
74
71
 
75
- if options[:voter].nil?
76
- return false
77
- end
72
+ self.vote_registered = false
78
73
 
79
74
  # find the vote
80
- votes = find_votes_for(voter_id: options[:voter].id,
81
- vote_scope: options[:vote_scope],
82
- voter_type: options[:voter].class.base_class.name)
75
+ votes = find_votes_by(options[:voter], options[:vote_scope])
83
76
 
84
- if votes.count == (0) || options[:duplicate]
77
+ if votes.empty? || options[:duplicate]
85
78
  # this voter has never voted
86
79
  vote = ActsAsVotable::Vote.new(
87
80
  votable: self,
@@ -100,24 +93,26 @@ module ActsAsVotable
100
93
  #Allowing for a vote_weight to be associated with every vote. Could change with every voter object
101
94
  vote.vote_weight = (options[:vote_weight].to_i if options[:vote_weight].present?) || 1
102
95
 
103
- if vote.save
96
+ ActiveRecord::Base.transaction do
97
+ self.vote_registered = false
98
+ return false unless vote.save
99
+
104
100
  self.vote_registered = true if last_update != vote.updated_at
105
- update_cached_votes options[:vote_scope]
101
+ update_cached_votes(options[:vote_scope])
106
102
  return true
107
- else
108
- self.vote_registered = false
109
- return false
110
103
  end
111
104
  end
112
105
 
113
106
  def unvote(args = {})
114
107
  return false if args[:voter].nil?
115
- votes = find_votes_for(voter_id: args[:voter].id, vote_scope: args[:vote_scope], voter_type: args[:voter].class.base_class.name)
108
+ votes = find_votes_by(args[:voter], args[:vote_scope])
116
109
 
117
- return true if votes.size == 0
118
- votes.each(&:destroy)
119
- update_cached_votes args[:vote_scope]
120
- self.vote_registered = false if votes_for.count == 0
110
+ return true if votes.empty?
111
+ ActiveRecord::Base.transaction do
112
+ votes.each(&:destroy)
113
+ update_cached_votes args[:vote_scope]
114
+ end
115
+ self.vote_registered = false if votes_for.empty?
121
116
  return true
122
117
  end
123
118
 
@@ -138,6 +133,12 @@ module ActsAsVotable
138
133
  votes_for.where(extra_conditions)
139
134
  end
140
135
 
136
+ def find_votes_by(voter, vote_scope)
137
+ find_votes_for(voter_id: voter.id,
138
+ vote_scope: vote_scope,
139
+ voter_type: voter.class.base_class.name)
140
+ end
141
+
141
142
  def get_up_votes(options = {})
142
143
  vote_scope_hash = scope_or_empty_hash(options[:vote_scope])
143
144
  find_votes_for({ vote_flag: true }.merge(vote_scope_hash))
@@ -151,7 +152,21 @@ module ActsAsVotable
151
152
  # voters
152
153
  def voted_on_by?(voter)
153
154
  votes = find_votes_for voter_id: voter.id, voter_type: voter.class.base_class.name
154
- votes.count > 0
155
+ votes.exists?
156
+ end
157
+
158
+ def voted_up_by?(voter)
159
+ votes = find_votes_for(voter_id: voter.id,
160
+ vote_flag: true,
161
+ voter_type: voter.class.base_class.name)
162
+ votes.exists?
163
+ end
164
+
165
+ def voted_down_by?(voter)
166
+ votes = find_votes_for(voter_id: voter.id,
167
+ vote_flag: false,
168
+ voter_type: voter.class.base_class.name)
169
+ votes.exists?
155
170
  end
156
171
 
157
172
  private
@@ -54,19 +54,19 @@ module ActsAsVotable
54
54
  def voted_on?(votable, args = {})
55
55
  votes = find_votes(votable_id: votable.id, votable_type: votable.class.base_class.name,
56
56
  vote_scope: args[:vote_scope])
57
- votes.size > 0
57
+ votes.exists?
58
58
  end
59
59
 
60
60
  def voted_up_on?(votable, args = {})
61
61
  votes = find_votes(votable_id: votable.id, votable_type: votable.class.base_class.name,
62
62
  vote_scope: args[:vote_scope], vote_flag: true)
63
- votes.size > 0
63
+ votes.exists?
64
64
  end
65
65
 
66
66
  def voted_down_on?(votable, args = {})
67
67
  votes = find_votes(votable_id: votable.id, votable_type: votable.class.base_class.name,
68
68
  vote_scope: args[:vote_scope], vote_flag: false)
69
- votes.size > 0
69
+ votes.exists?
70
70
  end
71
71
 
72
72
  def voted_as_when_voting_on(votable, args = {})
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :votable do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :votable_cache do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :votable_cache_update_attributes do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :votable_cache_update_columns do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :child_of_sti_not_votable do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :child_of_sti_votable do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :votable_voter do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :vote, class: ActsAsVotable::Vote do
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :voter do
5
5
  end
6
6
  end
@@ -106,6 +106,16 @@ shared_examples "a votable_model" do
106
106
  expect(votable.voted_on_by?(voter)).to be false
107
107
  end
108
108
 
109
+ it "should be voted up by a voter" do
110
+ votable.liked_by voter
111
+ expect(votable.voted_up_by?(voter)).to be true
112
+ end
113
+
114
+ it "should be voted down by a voter" do
115
+ votable.disliked_by voter
116
+ expect(votable.voted_down_by?(voter)).to be true
117
+ end
118
+
109
119
  it "should unvote a positive vote" do
110
120
  votable.vote_by voter: voter
111
121
  votable.unvote voter: voter
@@ -163,6 +173,32 @@ shared_examples "a votable_model" do
163
173
  expect(votable_cache.cached_votes_total).to eq(1)
164
174
  end
165
175
 
176
+ describe "with ActiveRecord::StaleObjectError" do
177
+ it "should rollback vote up if cache update fails" do
178
+ votable_cache.cached_votes_total = 50
179
+ expect(votable_cache)
180
+ .to(receive(:update_cached_votes)
181
+ .and_raise(ActiveRecord::StaleObjectError.new(votable_cache, "update")))
182
+
183
+ expect { votable_cache.vote_by voter: voter }.to raise_error ActiveRecord::StaleObjectError
184
+ expect(votable_cache.cached_votes_total).to eq(50)
185
+ expect(votable_cache.voted_on_by?(voter)).to be false
186
+ end
187
+
188
+ it "should rollback unvote if cache update fails" do
189
+ votable_cache.vote_by voter: voter, vote: "true"
190
+
191
+ expect(votable_cache)
192
+ .to(receive(:update_cached_votes)
193
+ .and_raise(ActiveRecord::StaleObjectError.new(votable_cache, "update")))
194
+
195
+ expect { votable_cache.unvote voter: voter }.to raise_error ActiveRecord::StaleObjectError
196
+
197
+ expect(votable_cache.cached_votes_total).to eq(1)
198
+ expect(votable_cache.voted_on_by?(voter)).to be true
199
+ end
200
+ end
201
+
166
202
  it "should update cached total votes_for when a vote up is removed" do
167
203
  votable_cache.vote_by voter: voter, vote: "true"
168
204
  votable_cache.unvote voter: voter
@@ -4,7 +4,7 @@ $LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
4
4
  require "sqlite3"
5
5
  require "simplecov"
6
6
  require "acts_as_votable"
7
- require "factory_girl"
7
+ require "factory_bot"
8
8
 
9
9
  Dir["./spec/shared_example/**/*.rb"].sort.each { |f| require f }
10
10
  Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.configure do |config|
4
+ config.include FactoryBot::Syntax::Methods
5
+
6
+ config.before(:suite) do
7
+ FactoryBot.find_definitions
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_votable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.2'
83
83
  - !ruby/object:Gem::Dependency
84
- name: factory_girl
84
+ name: factory_bot
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
@@ -106,16 +106,14 @@ files:
106
106
  - ".travis.yml"
107
107
  - Appraisals
108
108
  - Gemfile
109
- - README.markdown
109
+ - README.md
110
110
  - Rakefile
111
111
  - acts_as_votable.gemspec
112
112
  - gemfiles/.bundle/config
113
113
  - gemfiles/rails_4.gemfile
114
- - gemfiles/rails_4.gemfile.lock
115
114
  - gemfiles/rails_5.gemfile
116
- - gemfiles/rails_5.gemfile.lock
117
115
  - gemfiles/rails_5_1.gemfile
118
- - gemfiles/rails_5_1.gemfile.lock
116
+ - gemfiles/rails_5_2.gemfile
119
117
  - lib/acts_as_votable.rb
120
118
  - lib/acts_as_votable/cacheable.rb
121
119
  - lib/acts_as_votable/extenders/controller.rb
@@ -141,7 +139,7 @@ files:
141
139
  - spec/shared_example/votable_model.rb
142
140
  - spec/shared_example/voter_model.rb
143
141
  - spec/spec_helper.rb
144
- - spec/support/factory_girl.rb
142
+ - spec/support/factory_bot.rb
145
143
  - spec/votable_spec.rb
146
144
  - spec/votable_voter_spec.rb
147
145
  - spec/voter_spec.rb
@@ -166,8 +164,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
164
  version: '0'
167
165
  requirements: []
168
166
  rubyforge_project: acts_as_votable
169
- rubygems_version: 2.6.13
167
+ rubygems_version: 2.4.5.1
170
168
  signing_key:
171
169
  specification_version: 4
172
170
  summary: Rails gem to allowing records to be votable
173
- test_files: []
171
+ test_files:
172
+ - spec/factories/votable.rb
173
+ - spec/factories/votable_cache.rb
174
+ - spec/factories/votable_cache_update_attributes.rb
175
+ - spec/factories/votable_cache_update_columns.rb
176
+ - spec/factories/votable_child_of_sti_not_votable.rb
177
+ - spec/factories/votable_child_of_sti_votable.rb
178
+ - spec/factories/votable_voter.rb
179
+ - spec/factories/vote.rb
180
+ - spec/factories/voter.rb
181
+ - spec/generators/active_record_generator_spec.rb
182
+ - spec/shared_example/votable_model.rb
183
+ - spec/shared_example/voter_model.rb
184
+ - spec/spec_helper.rb
185
+ - spec/support/factory_bot.rb
186
+ - spec/votable_spec.rb
187
+ - spec/votable_voter_spec.rb
188
+ - spec/voter_spec.rb
189
+ - spec/words_spec.rb
@@ -1,159 +0,0 @@
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
@@ -1,166 +0,0 @@
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
@@ -1,166 +0,0 @@
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
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # spec/support/factory_girl.rb
4
- RSpec.configure do |config|
5
- config.include FactoryGirl::Syntax::Methods
6
-
7
- config.before(:suite) do
8
- FactoryGirl.find_definitions
9
- end
10
- end