mix_tape 0.0.4 → 0.0.5
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/mix_tape/builder.rb
CHANGED
@@ -7,12 +7,24 @@ module MixTape
|
|
7
7
|
@console_logging = console_logging
|
8
8
|
end
|
9
9
|
|
10
|
-
def track(name, args={})
|
11
|
-
puts "FakeTracker.track #{name}, #{args}" if console_logging
|
10
|
+
def track(distinct_id, name, args={})
|
11
|
+
puts "FakeTracker.track #{distinct_id}, #{name}, #{args}" if console_logging
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def people
|
15
|
+
@people ||= People.new(console_logging)
|
16
|
+
end
|
17
|
+
|
18
|
+
class People
|
19
|
+
attr_reader :console_logging
|
20
|
+
|
21
|
+
def initialize(console_logging)
|
22
|
+
@console_logging = console_logging
|
23
|
+
end
|
24
|
+
|
25
|
+
def set(name, args={})
|
26
|
+
puts "FakeTracker.set #{name}, #{args}" if console_logging
|
27
|
+
end
|
16
28
|
end
|
17
29
|
end
|
18
30
|
|
data/lib/mix_tape/version.rb
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
describe "Triggering Events" do
|
24
24
|
let(:user) { double(username: 'Zeus', id: '1') }
|
25
25
|
let(:button) { double(id: '2', page: 'homepage') }
|
26
|
-
let(:client) { double('client') }
|
26
|
+
let(:client) { double('client', people: double) }
|
27
27
|
|
28
28
|
before do
|
29
29
|
MixTape.stub(:client){ client }
|
@@ -39,7 +39,7 @@ describe "Triggering Events" do
|
|
39
39
|
it "sets" do
|
40
40
|
expected_properties = { user_name: "Zeus", distinct_id: "1", button_id: "2", button_page: "homepage" }
|
41
41
|
|
42
|
-
client.should_receive(:set).with("1", expected_properties)
|
42
|
+
client.people.should_receive(:set).with("1", expected_properties)
|
43
43
|
MixTape.set_button_click(user.id, user, button)
|
44
44
|
end
|
45
45
|
end
|
@@ -1,17 +1,19 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'FakeTracker' do
|
4
|
+
let(:distinct_id) { 1 }
|
5
|
+
|
4
6
|
context 'logging' do
|
5
7
|
let(:client) { MixTape::FakeTracker.new(true) }
|
6
8
|
|
7
9
|
it "logs track events to the console" do
|
8
10
|
Object.any_instance.should_receive(:puts)
|
9
|
-
client.track "button_click"
|
11
|
+
client.track distinct_id, "button_click"
|
10
12
|
end
|
11
13
|
|
12
14
|
it "logs set events to the console" do
|
13
15
|
Object.any_instance.should_receive(:puts)
|
14
|
-
client.set 1
|
16
|
+
client.people.set 1
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
@@ -20,8 +22,8 @@ describe 'FakeTracker' do
|
|
20
22
|
|
21
23
|
it "does not log anything" do
|
22
24
|
Object.any_instance.should_not_receive(:puts)
|
23
|
-
client.track "button_click"
|
24
|
-
client.set 1
|
25
|
+
client.track distinct_id, "button_click"
|
26
|
+
client.people.set 1
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mix_tape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|