analytics-ruby-mock 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/analytics_ruby_mock.rb +34 -0
  2. metadata +1 -1
@@ -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}" : ""}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics-ruby-mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: