forked from railslove/rack-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo_squared_integration_spec.rb
More file actions
72 lines (59 loc) · 1.84 KB
/
Copy pathgo_squared_integration_spec.rb
File metadata and controls
72 lines (59 loc) · 1.84 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require 'support/capybara_app_helper'
RSpec.describe "GoSquared Integration" do
subject { page }
before do
setup_app(action: :go_squared) do |tracker|
tracker.handler :go_squared, {
tracker: '123456',
anonymize_ip: true,
cookie_domain: 'domain.com',
use_cookies: true,
track_hash: true,
track_local: true,
track_params: true
}
end
visit '/'
end
it "adds the tracker to the page" do
expect(page).to have_content("_gs('123456');")
end
it "adds the visitorName to the page" do
expect(page).to have_content('_gs("set","visitorName","John Doe");')
end
it "adds the visitor to the page" do
expect(page).to have_content('_gs("set","visitor",{"age":35,"favorite_food":"pizza"});')
end
it "sets anonymizeIp" do
expect(page).to have_content("_gs('set', 'anonymizeIp', true);")
end
it "sets cookieDomain" do
expect(page).to have_content("_gs('set', 'cookieDomain', 'domain.com');")
end
it "sets useCookies" do
expect(page).to have_content("_gs('set', 'useCookies', true);")
end
it "sets trackHash" do
expect(page).to have_content("_gs('set', 'trackHash', true);")
end
it "sets trackLocal" do
expect(page).to have_content("_gs('set', 'trackLocal', true);")
end
it "sets trackParams" do
expect(page).to have_content("_gs('set', 'trackParams', true);")
end
context 'multiple trackers are passed in' do
before do
setup_app(action: :go_squared) do |tracker|
tracker.handler :go_squared, {
trackers: { primaryTracker: '12345', secondaryTracker: '67890' }
}
end
visit '/'
end
it "adds the tracker to the page" do
expect(page).to have_content("_gs('12345', 'primaryTracker');")
expect(page).to have_content("_gs('67890', 'secondaryTracker');")
end
end
end