sir_tracks_alot 0.4.0 → 0.6.2
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.
- data/Gemfile +2 -1
- data/Gemfile.lock +54 -0
- data/README.rdoc +29 -1
- data/VERSION +1 -1
- data/benchmarks/activity_benchmark.rb +22 -23
- data/benchmarks/benchmark_helper.rb +30 -0
- data/benchmarks/count_benchmark.rb +33 -0
- data/lib/sir_tracks_alot.rb +16 -14
- data/lib/sir_tracks_alot/activity.rb +7 -6
- data/lib/sir_tracks_alot/clock.rb +4 -0
- data/lib/sir_tracks_alot/count.rb +87 -39
- data/lib/sir_tracks_alot/event_helper.rb +1 -1
- data/lib/sir_tracks_alot/filter_helper.rb +28 -18
- data/lib/sir_tracks_alot/persistable.rb +4 -0
- data/lib/sir_tracks_alot/queue/report_cache.rb +2 -0
- data/lib/sir_tracks_alot/queue/report_config.rb +3 -0
- data/lib/sir_tracks_alot/queue/report_queue.rb +8 -10
- data/lib/sir_tracks_alot/reports/actor_activity_report.rb +3 -3
- data/lib/sir_tracks_alot/reports/basic_report.rb +1 -1
- data/lib/sir_tracks_alot/reports/filter_report.rb +5 -11
- data/lib/sir_tracks_alot/reports/report.rb +16 -2
- data/lib/sir_tracks_alot/reports/simple_report.rb +43 -0
- data/lib/sir_tracks_alot/reports/target_report.rb +2 -7
- data/lib/sir_tracks_alot/summary.rb +9 -0
- data/sir_tracks_alot.gemspec +140 -0
- data/spec/activity_spec.rb +18 -59
- data/spec/count_spec.rb +56 -25
- data/spec/queue/report_queue_spec.rb +8 -8
- data/spec/redis_spec_helper.rb +8 -0
- data/spec/reports/actor_report_spec.rb +16 -16
- data/spec/reports/filter_report_spec.rb +1 -1
- data/spec/reports/report_spec.rb +15 -0
- data/spec/reports/root_stem_report_spec.rb +1 -1
- data/spec/reports/simple_report_spec.rb +63 -0
- data/spec/reports/target_report_spec.rb +9 -4
- data/spec/sir_tracks_alot_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -9
- metadata +38 -10
@@ -6,21 +6,26 @@ describe SirTracksAlot::Reports::TargetReport do
|
|
6
6
|
before do
|
7
7
|
RedisSpecHelper.reset
|
8
8
|
@activities.each{|a| SirTracksAlot.record(a)}
|
9
|
+
SirTracksAlot::Count.count(:owner => 'owner')
|
9
10
|
end
|
10
11
|
|
11
12
|
context 'building HTML' do
|
12
13
|
before do
|
13
|
-
|
14
|
-
@html = SirTracksAlot::Reports::TargetReport.render_html(:
|
14
|
+
rows = SirTracksAlot::Count.rows(:owner => 'owner')
|
15
|
+
@html = SirTracksAlot::Reports::TargetReport.render_html(:rows => rows, :report_class => 'customClass')
|
15
16
|
end
|
16
17
|
|
17
18
|
it_should_behave_like 'all reports'
|
18
19
|
|
19
|
-
it "include target row" do
|
20
|
+
it "should include target row" do
|
20
21
|
@html.should have_tag('td.target', /\/categories\/item/)
|
21
22
|
end
|
22
23
|
|
23
|
-
it "
|
24
|
+
it "should have custom class" do
|
25
|
+
@html.should have_tag('div.customClass')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should include count row" do
|
24
29
|
@html.should have_tag('td.count', /1/)
|
25
30
|
end
|
26
31
|
|
@@ -59,6 +59,10 @@ describe SirTracksAlot, 'when recording' do
|
|
59
59
|
SirTracksAlot.record(@record_attributes)
|
60
60
|
end
|
61
61
|
|
62
|
+
it "should force new activity to uncounted" do
|
63
|
+
SirTracksAlot.record(@record_attributes.merge(:counted => '1')).counted.should == '0'
|
64
|
+
end
|
65
|
+
|
62
66
|
it "should add custom event if provided" do
|
63
67
|
SirTracksAlot::Clock.should_receive(:now).once # only for activity create, not for events date
|
64
68
|
SirTracksAlot.record(@record_attributes.merge(:event => Time.now.utc.to_i))
|
data/spec/spec_helper.rb
CHANGED
@@ -13,20 +13,12 @@ Bundler.require(:development)
|
|
13
13
|
|
14
14
|
require 'spec/reports/shared_report_specs'
|
15
15
|
require 'sir_tracks_alot'
|
16
|
+
require 'spec/redis_spec_helper'
|
16
17
|
|
17
18
|
Spec::Runner.configure do |config|
|
18
19
|
config.include(RspecHpricotMatchers)
|
19
20
|
end
|
20
21
|
|
21
|
-
class RedisSpecHelper
|
22
|
-
TEST_OPTIONS = {:db => 15}
|
23
|
-
|
24
|
-
def self.reset
|
25
|
-
Ohm.connect(TEST_OPTIONS)
|
26
|
-
Ohm.flush
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
22
|
module DataHelper
|
31
23
|
def initialize(*attrs)
|
32
24
|
super
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sir_tracks_alot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peter T. Brown
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-18 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -64,12 +64,14 @@ dependencies:
|
|
64
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
hash:
|
69
|
+
hash: 83
|
70
70
|
segments:
|
71
71
|
- 0
|
72
|
-
|
72
|
+
- 0
|
73
|
+
- 38
|
74
|
+
version: 0.0.38
|
73
75
|
type: :runtime
|
74
76
|
name: ohm
|
75
77
|
prerelease: false
|
@@ -113,7 +115,7 @@ dependencies:
|
|
113
115
|
- 0
|
114
116
|
version: "0"
|
115
117
|
type: :development
|
116
|
-
name:
|
118
|
+
name: color
|
117
119
|
prerelease: false
|
118
120
|
version_requirements: *id007
|
119
121
|
- !ruby/object:Gem::Dependency
|
@@ -127,9 +129,23 @@ dependencies:
|
|
127
129
|
- 0
|
128
130
|
version: "0"
|
129
131
|
type: :development
|
130
|
-
name:
|
132
|
+
name: rspec_hpricot_matchers
|
131
133
|
prerelease: false
|
132
134
|
version_requirements: *id008
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
type: :development
|
146
|
+
name: hpricot
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: *id009
|
133
149
|
description: A high speed general purpose tracking and reporting tool which uses Redis.
|
134
150
|
email: peter@flippyhead.com
|
135
151
|
executables: []
|
@@ -141,11 +157,14 @@ extra_rdoc_files:
|
|
141
157
|
- README.rdoc
|
142
158
|
files:
|
143
159
|
- Gemfile
|
160
|
+
- Gemfile.lock
|
144
161
|
- LICENSE
|
145
162
|
- README.rdoc
|
146
163
|
- Rakefile
|
147
164
|
- VERSION
|
148
165
|
- benchmarks/activity_benchmark.rb
|
166
|
+
- benchmarks/benchmark_helper.rb
|
167
|
+
- benchmarks/count_benchmark.rb
|
149
168
|
- benchmarks/report_benchmark.rb
|
150
169
|
- lib/sir_tracks_alot.rb
|
151
170
|
- lib/sir_tracks_alot/activity.rb
|
@@ -165,19 +184,25 @@ files:
|
|
165
184
|
- lib/sir_tracks_alot/reports/filter_report.rb
|
166
185
|
- lib/sir_tracks_alot/reports/report.rb
|
167
186
|
- lib/sir_tracks_alot/reports/root_stem_report.rb
|
187
|
+
- lib/sir_tracks_alot/reports/simple_report.rb
|
168
188
|
- lib/sir_tracks_alot/reports/target_report.rb
|
169
189
|
- lib/sir_tracks_alot/reports/trackable_report.rb
|
190
|
+
- lib/sir_tracks_alot/summary.rb
|
191
|
+
- sir_tracks_alot.gemspec
|
170
192
|
- spec/activity_spec.rb
|
171
193
|
- spec/count_spec.rb
|
172
194
|
- spec/queue/report_config_spec.rb
|
173
195
|
- spec/queue/report_queue_spec.rb
|
196
|
+
- spec/redis_spec_helper.rb
|
174
197
|
- spec/reports/activity_report_spec.rb
|
175
198
|
- spec/reports/actor_activity_report_spec.rb
|
176
199
|
- spec/reports/actor_report_spec.rb
|
177
200
|
- spec/reports/basic_report_spec.rb
|
178
201
|
- spec/reports/filter_report_spec.rb
|
202
|
+
- spec/reports/report_spec.rb
|
179
203
|
- spec/reports/root_stem_report_spec.rb
|
180
204
|
- spec/reports/shared_report_specs.rb
|
205
|
+
- spec/reports/simple_report_spec.rb
|
181
206
|
- spec/reports/target_report_spec.rb
|
182
207
|
- spec/sir_tracks_alot_spec.rb
|
183
208
|
- spec/spec.opts
|
@@ -225,13 +250,16 @@ test_files:
|
|
225
250
|
- spec/count_spec.rb
|
226
251
|
- spec/queue/report_config_spec.rb
|
227
252
|
- spec/queue/report_queue_spec.rb
|
253
|
+
- spec/redis_spec_helper.rb
|
228
254
|
- spec/reports/activity_report_spec.rb
|
229
255
|
- spec/reports/actor_activity_report_spec.rb
|
230
256
|
- spec/reports/actor_report_spec.rb
|
231
257
|
- spec/reports/basic_report_spec.rb
|
232
258
|
- spec/reports/filter_report_spec.rb
|
259
|
+
- spec/reports/report_spec.rb
|
233
260
|
- spec/reports/root_stem_report_spec.rb
|
234
261
|
- spec/reports/shared_report_specs.rb
|
262
|
+
- spec/reports/simple_report_spec.rb
|
235
263
|
- spec/reports/target_report_spec.rb
|
236
264
|
- spec/sir_tracks_alot_spec.rb
|
237
265
|
- spec/spec_helper.rb
|