smooch 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smooch.rb +1 -1
- data/lib/smooch/base.rb +5 -5
- data/lib/smooch/version.rb +1 -1
- data/spec/base_spec.rb +23 -0
- metadata +4 -4
data/lib/smooch.rb
CHANGED
data/lib/smooch/base.rb
CHANGED
@@ -111,11 +111,11 @@ module Smooch
|
|
111
111
|
def push_record(hash)
|
112
112
|
out = ""
|
113
113
|
hash.each do |key, value|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
114
|
+
out += "_kmq.push(['record', '#{js(key)}'"
|
115
|
+
unless value.empty?
|
116
|
+
out += ", #{value.to_json}"
|
117
|
+
end
|
118
|
+
out += "]);\n"
|
119
119
|
end
|
120
120
|
out = out.html_safe if out.respond_to?(:html_safe)
|
121
121
|
out
|
data/lib/smooch/version.rb
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -9,6 +9,10 @@ class TestSmooch < Smooch::Base
|
|
9
9
|
def set_cookie(key, name)
|
10
10
|
@@cookies[key] = name
|
11
11
|
end
|
12
|
+
def get_kiss_identity
|
13
|
+
"123456789"
|
14
|
+
end
|
15
|
+
|
12
16
|
end
|
13
17
|
|
14
18
|
describe TestSmooch do
|
@@ -48,4 +52,23 @@ describe TestSmooch do
|
|
48
52
|
km.api_key.should == "test_key_here"
|
49
53
|
end
|
50
54
|
end
|
55
|
+
|
56
|
+
describe "#script" do
|
57
|
+
before(:each) do
|
58
|
+
@km = TestSmooch.new
|
59
|
+
@km.view = ActionView::Base.new
|
60
|
+
end
|
61
|
+
it "should include the record" do
|
62
|
+
@km.record("something")
|
63
|
+
@km.script.should include("_kmq.push(['record', 'something']);")
|
64
|
+
end
|
65
|
+
it "should include the key" do
|
66
|
+
@km.script.should include("_kmq.push(['identify', '123456789']);")
|
67
|
+
end
|
68
|
+
it "should include the recorded properties" do
|
69
|
+
@km.record("something", :key => "val")
|
70
|
+
@km.script.should include("_kmq.push(['record', 'something', {\"key\":\"val\"}]);")
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
51
74
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smooch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Leonard
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|