voting 0.4.0 → 0.5.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
- SHA1:
3
- metadata.gz: 773d5bef0344e32f9145f9914d658e294a8f7a54
4
- data.tar.gz: 8dc4829ed97d9221f2f5c3e1d59beb1d39e84f86
2
+ SHA256:
3
+ metadata.gz: 7bffe7669898ab09e908e5e869f11177db187c491d7ae6d96ed8e6c9814323ba
4
+ data.tar.gz: b586d8c3d692abc2e6ca0389988b797c83c70bfbfbbd947e28f83fe768f81509
5
5
  SHA512:
6
- metadata.gz: 8d86bbbd61fa28632c1de5ae3b8f91a9bdc36efa7c2f7218b0cf906b26d94d13d565d687d58ca48e3657427ea68a11903b62bedd002c04d2dcd22891618afeee
7
- data.tar.gz: 9e838b03931f25a28cd3bf3895d96014a807432099ef6e0a5d732eecf9314b75bbe91c8b10fcef3a9f6f1251ffbc8b14f7a2653f3812e142c9829c614dee0636
6
+ metadata.gz: 42dfc72e269ad484fc0d337fe1cb089cad2d27057bbf83e8873c7fcce62e6ffc1c5dcae870215d670751a5197b624bc1ed55d1113b6a5bbc9df3cec46005c2c0
7
+ data.tar.gz: dbe5b7d635f3f7431d98f90095ea959eb2b32eb4ed909d79cbdf6051db07cca037d0491fa6f78ea9f0718be926e7746418daef6150f3452c8683f0248d75085b
@@ -1,3 +1,10 @@
1
+ ## v0.5.0
2
+
3
+ ### Update
4
+
5
+ - Support for Rails 6;
6
+ - Support for Ruby 2.6.5.
7
+
1
8
  ## v0.4.0
2
9
 
3
10
  ### Updates
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/wbotelhos/voting.svg)](https://travis-ci.org/wbotelhos/voting)
4
4
  [![Gem Version](https://badge.fury.io/rb/voting.svg)](https://badge.fury.io/rb/voting)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/dcdf51e3093148c5ac6a/maintainability)](https://codeclimate.com/github/wbotelhos/voting/maintainability)
6
- [![Support](https://img.shields.io/badge/donate-%3C3-brightgreen.svg)](https://liberapay.com/wbotelhos)
6
+ [![Patreon](https://img.shields.io/badge/donate-%3C3-brightgreen.svg)](https://www.patreon.com/wbotelhos)
7
7
 
8
8
  A Binomial proportion confidence interval voting system with scope and cache enabled.
9
9
 
@@ -264,7 +264,3 @@ Now, when a resource is created, the cache will be generated for each related `c
264
264
  - [Jonathan Landy](http://efavdb.com/ranking-revisited)
265
265
  - [Wilson Score Interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval)
266
266
  - [How to Count Thumb-Ups and Thumb-Downs](http://www.dcs.bbk.ac.uk/~dell/publications/dellzhang_ictir2011.pdf)
267
-
268
- ## Love it!
269
-
270
- Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=voting) or [Support](https://liberapay.com/wbotelhos). Thanks! (:
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Voting
4
4
  class InstallGenerator < Rails::Generators::Base
5
- source_root File.expand_path('../templates', __FILE__)
5
+ source_root File.expand_path('templates', __dir__)
6
6
 
7
7
  desc 'creates Voting migration'
8
8
 
@@ -14,8 +14,8 @@ class CreateVotingTables < ActiveRecord::Migration[5.0]
14
14
  end
15
15
 
16
16
  add_index :voting_votes, %i[author_id author_type resource_id resource_type scopeable_id scopeable_type],
17
- name: :index_voting_votes_on_author_and_resource_and_scopeable,
18
- unique: true
17
+ name: :index_voting_votes_on_author_and_resource_and_scopeable,
18
+ unique: true
19
19
 
20
20
  create_table :voting_votings do |t|
21
21
  t.decimal :estimate, default: 0, mull: false, precision: 25, scale: 20
@@ -29,7 +29,7 @@ class CreateVotingTables < ActiveRecord::Migration[5.0]
29
29
  end
30
30
 
31
31
  add_index :voting_votings, %i[resource_id resource_type scopeable_id scopeable_type],
32
- name: :index_voting_votings_on_resource_and_scopeable,
33
- unique: true
32
+ name: :index_voting_votings_on_resource_and_scopeable,
33
+ unique: true
34
34
  end
35
35
  end
@@ -59,23 +59,23 @@ module Voting
59
59
  after_create -> { voting_warm_up scoping: scoping }, unless: -> { as == :author }
60
60
 
61
61
  has_many :voting_records,
62
- as: :resource,
63
- class_name: '::Voting::Voting',
64
- dependent: :destroy
62
+ as: :resource,
63
+ class_name: '::Voting::Voting',
64
+ dependent: :destroy
65
65
 
66
66
  has_many :votes_records,
67
- as: :resource,
68
- class_name: '::Voting::Vote',
69
- dependent: :destroy
67
+ as: :resource,
68
+ class_name: '::Voting::Vote',
69
+ dependent: :destroy
70
70
 
71
71
  has_many :voted_records,
72
- as: :author,
73
- class_name: '::Voting::Vote',
74
- dependent: :destroy
72
+ as: :author,
73
+ class_name: '::Voting::Vote',
74
+ dependent: :destroy
75
75
 
76
- scope :order_by_voting, ->(column = :estimate, direction = :desc, scope: nil) {
76
+ scope :order_by_voting, lambda { |column = :estimate, direction = :desc, scope: nil|
77
77
  scope_values = {
78
- scopeable_id: scope&.id,
78
+ scopeable_id: scope&.id,
79
79
  scopeable_type: scope&.class&.base_class&.name
80
80
  }
81
81
 
@@ -15,7 +15,7 @@ module Voting
15
15
 
16
16
  validates :author_id, uniqueness: {
17
17
  case_sensitive: false,
18
- scope: %i[author_type resource_id resource_type scopeable_id scopeable_type]
18
+ scope: %i[author_type resource_id resource_type scopeable_id scopeable_type]
19
19
  }
20
20
 
21
21
  def status
@@ -13,7 +13,7 @@ module Voting
13
13
 
14
14
  validates :resource_id, uniqueness: {
15
15
  case_sensitive: false,
16
- scope: %i[resource_type scopeable_id scopeable_type]
16
+ scope: %i[resource_type scopeable_id scopeable_type]
17
17
  }
18
18
 
19
19
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Voting
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :voting_voting, class: Voting::Voting do
5
- estimate 100
5
+ estimate { 100 }
6
6
 
7
7
  association :resource, factory: :comment, strategy: :build
8
8
  end
@@ -7,7 +7,6 @@ RSpec.describe Voting::Vote, '.status' do
7
7
  let!(:resource) { create :comment }
8
8
 
9
9
  context 'with no scope' do
10
-
11
10
  it 'returns the status' do
12
11
  expect(author.up(resource).status).to eq 'positive'
13
12
  expect(author.down(resource).status).to eq 'negative'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_context 'with_database_records' do
2
4
  let!(:category) { create :category }
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-11 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '6'
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '4.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '6'
26
+ version: '0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: database_cleaner
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -207,8 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
201
  - !ruby/object:Gem::Version
208
202
  version: '0'
209
203
  requirements: []
210
- rubyforge_project:
211
- rubygems_version: 2.6.14
204
+ rubygems_version: 3.0.6
212
205
  signing_key:
213
206
  specification_version: 4
214
207
  summary: A Binomial proportion confidence interval voting system with scope and cache