punching_bag 0.5.0 → 0.6.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.
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe PunchingBag::ActiveRecord::ClassMethods do
4
+
5
+ let(:request) { instance_double(ActionDispatch::Request, bot?: false) }
6
+
7
+ let(:article1) { Article.create title: 'Article 1', content: 'Ding, ding ding... ding. Ding. DING. DING! ' }
8
+ let(:article2) { Article.create title: 'Article 2', content: 'Ding, ding ding... ding. Ding. DING. DING! ' }
9
+
10
+ before do
11
+ PunchingBag.punch(article1, request)
12
+ PunchingBag.punch(article2, request)
13
+ PunchingBag.punch(article2, request)
14
+ end
15
+
16
+ describe '.most_hit' do
17
+ it 'finds correct result' do
18
+ expect(Article.most_hit).to include(article2)
19
+ end
20
+ end
21
+
22
+ describe '.sort_by_popularity' do
23
+ it 'sorts DESC' do
24
+ expect(Article.sort_by_popularity('DESC')).to eq([article2, article1])
25
+ end
26
+ it 'sorts ASC' do
27
+ expect(Article.sort_by_popularity('ASC')).to eq([article1, article2])
28
+ end
29
+ end
30
+
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punching_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Crownoble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.2'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: voight_kampff
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -116,7 +110,7 @@ dependencies:
116
110
  version: '1.3'
117
111
  description: PunchingBag is a hit counting and simple trending engine for Ruby on
118
112
  Rails
119
- email: adam@obledesign.com
113
+ email: adam@codenoble.com
120
114
  executables: []
121
115
  extensions: []
122
116
  extra_rdoc_files: []
@@ -136,6 +130,7 @@ files:
136
130
  - spec/internal/db/combustion_test.sqlite
137
131
  - spec/internal/db/schema.rb
138
132
  - spec/internal/log/test.log
133
+ - spec/lib/punching_bag/acts_as_punchable_spec.rb
139
134
  - spec/lib/punching_bag_spec.rb
140
135
  - spec/models/punch_spec.rb
141
136
  - spec/models/punchable_spec.rb
@@ -160,18 +155,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
155
  version: '0'
161
156
  requirements: []
162
157
  rubyforge_project:
163
- rubygems_version: 2.2.2
158
+ rubygems_version: 2.6.11
164
159
  signing_key:
165
160
  specification_version: 4
166
161
  summary: PunchingBag hit conter and trending plugin
167
162
  test_files:
168
- - spec/lib/punching_bag_spec.rb
169
- - spec/spec_helper.rb
170
- - spec/internal/db/schema.rb
171
- - spec/internal/db/combustion_test.sqlite
172
- - spec/internal/config/database.yml
173
163
  - spec/internal/app/models/article.rb
164
+ - spec/internal/config/database.yml
165
+ - spec/internal/db/combustion_test.sqlite
166
+ - spec/internal/db/schema.rb
174
167
  - spec/internal/log/test.log
175
- - spec/models/punchable_spec.rb
168
+ - spec/lib/punching_bag/acts_as_punchable_spec.rb
169
+ - spec/lib/punching_bag_spec.rb
176
170
  - spec/models/punch_spec.rb
177
- has_rdoc:
171
+ - spec/models/punchable_spec.rb
172
+ - spec/spec_helper.rb