forked from amclelland/rack-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo_squared_spec.rb
More file actions
46 lines (37 loc) · 1.11 KB
/
go_squared_spec.rb
File metadata and controls
46 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
RSpec.describe Rack::Tracker::GoSquared do
def env
{misc: 'foobar'}
end
it 'will be placed in the head' do
expect(described_class.position).to eq(:head)
expect(described_class.new(env).position).to eq(:head)
end
describe "with events" do
describe "visitor name" do
def env
{'tracker' => {
'go_squared' => [
{ 'class_name' => 'VisitorName', 'name' => 'John Doe' }
]
}}
end
subject { described_class.new(env, tracker: '12345').render }
it "will show the right name" do
expect(subject).to match(%r{_gs\(\"set\",\"visitorName\",\"John Doe\"\)})
end
end
describe "visitor details" do
def env
{'tracker' => {
'go_squared' => [
{ 'class_name' => 'VisitorInfo', 'age' => 35, 'favorite_food' => 'pizza' }
]
}}
end
subject { described_class.new(env, tracker: '12345').render }
it "will show the right properties" do
expect(subject).to match(%r{_gs\(\"set\",\"visitor\",{\"age\":35,\"favorite_food\":\"pizza\"}\)})
end
end
end
end