analytics-ruby-mock 0.0.2 → 0.0.3
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/lib/analytics_ruby_mock.rb +34 -0
- metadata +1 -1
data/lib/analytics_ruby_mock.rb
CHANGED
@@ -2,14 +2,38 @@ module AnalyticsRuby
|
|
2
2
|
module ClassMethods
|
3
3
|
def track(options)
|
4
4
|
debug_message(:track, options)
|
5
|
+
|
6
|
+
initialize if @track_count.nil?
|
7
|
+
@track_count = @track_count + 1
|
8
|
+
end
|
9
|
+
|
10
|
+
def track_count
|
11
|
+
initialize if @track_count.nil?
|
12
|
+
@track_count
|
5
13
|
end
|
6
14
|
|
7
15
|
def identify(options)
|
8
16
|
debug_message(:identify, options)
|
17
|
+
|
18
|
+
initialize if @identify_count.nil?
|
19
|
+
@identify_count = @identify_count + 1
|
20
|
+
end
|
21
|
+
|
22
|
+
def identify_count
|
23
|
+
initialize if @identify_count.nil?
|
24
|
+
@identify_count
|
9
25
|
end
|
10
26
|
|
11
27
|
def alias(options)
|
12
28
|
debug_message(:alias, options)
|
29
|
+
|
30
|
+
initialize if @alias_count.nil?
|
31
|
+
@alias_count = @alias_count + 1
|
32
|
+
end
|
33
|
+
|
34
|
+
def alias_count
|
35
|
+
initialize if @alias_count.nil?
|
36
|
+
@alias_count
|
13
37
|
end
|
14
38
|
|
15
39
|
def flush
|
@@ -20,8 +44,18 @@ module AnalyticsRuby
|
|
20
44
|
@debug = true
|
21
45
|
end
|
22
46
|
|
47
|
+
def clear_counts
|
48
|
+
initialize
|
49
|
+
end
|
50
|
+
|
23
51
|
private
|
24
52
|
|
53
|
+
def initialize
|
54
|
+
@track_count = 0
|
55
|
+
@identify_count = 0
|
56
|
+
@alias_count = 0
|
57
|
+
end
|
58
|
+
|
25
59
|
def debug_message(method, options = nil)
|
26
60
|
if @debug
|
27
61
|
puts "Mock of AnalyticsRuby called #{method.to_s} #{options.present? ? "with: #{options}" : ""}"
|