smooch 0.1.1 → 0.1.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/lib/smooch.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Smooch
2
- API_KEY = ''
2
+ #API_KEY = ''
3
3
  end
4
4
 
5
5
  begin
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
- out += "_kmq.push(['record', '#{js(key)}'"
115
- unless value.empty?
116
- out += ", #{value.as_json}"
117
- end
118
- out += "]);\n"
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
@@ -1,3 +1,3 @@
1
1
  module Smooch
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.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-07 00:00:00 -08:00
18
+ date: 2011-02-28 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21