urchin_tracking_module 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/urchin_tracking_module.rb +1 -1
- data/lib/urchin_tracking_module/version.rb +1 -1
- data/spec/urchin_tracking_module_spec.rb +12 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e178ebe92fe8c07ebdfc73fb9ba15afc86135918
|
4
|
+
data.tar.gz: 40b77d0dfb8b7a1884f5bf85364ba9d2a4b69c42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc52e6adb9f505e45e4a8e525a88afc202c0f60372bc284f982b8b052d759846eff8fad054382c2d1fcf1a9efa77f7ebbcbf62cb6f60b11ed076415a50c4fd8d
|
7
|
+
data.tar.gz: 570a955bc823b507df562e4e871d45a0855995dda2132967a335719d2aa4987ed7782e2b35ee57cb61fe64b4cc37a4f8ac165a3846bc340345a0a17f146a191b
|
@@ -4,10 +4,9 @@ require 'uri'
|
|
4
4
|
require 'spec_helper'
|
5
5
|
|
6
6
|
describe UrchinTrackingModule do
|
7
|
-
Utm = UrchinTrackingModule
|
8
7
|
let(:params) {{}}
|
9
8
|
let(:url) { 'http://example.com?src=fba_blooming/#/shops' }
|
10
|
-
subject {
|
9
|
+
subject { UrchinTrackingModule.new(url) }
|
11
10
|
|
12
11
|
context 'basic tracking' do
|
13
12
|
let(:params) {{
|
@@ -17,7 +16,7 @@ describe UrchinTrackingModule do
|
|
17
16
|
utm_content: 'variant_guy',
|
18
17
|
utm_campaign: 'xmas_2013' }}
|
19
18
|
|
20
|
-
|
19
|
+
UrchinTrackingModule::TRACKING_PARAMETERS.each do |tracking_param|
|
21
20
|
it "tracks #{tracking_param}" do
|
22
21
|
uri = subject.tracking(params)
|
23
22
|
expect(uri).to match(/#{tracking_param}=#{params[tracking_param]}/)
|
@@ -36,14 +35,14 @@ describe UrchinTrackingModule do
|
|
36
35
|
|
37
36
|
EXAMPLE_CONFIG.each do |(name,value)|
|
38
37
|
it "configures #{name}" do
|
39
|
-
|
38
|
+
UrchinTrackingModule.configure { |utm| utm[name]= value }
|
40
39
|
expect(subject.tracking).to match(/#{name}=#{value}/)
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
43
|
it 'configures src' do
|
45
44
|
# checking for side effects and overrides
|
46
|
-
|
45
|
+
UrchinTrackingModule.configure { |utm| utm[:utm_source]= 'funnel_source_for_bi' }
|
47
46
|
expect(subject.tracking).to match(/src=funnel_source_for_bi/)
|
48
47
|
expect(UTM(url, utm_source: 'pewpew')).to match(/src=pewpew/)
|
49
48
|
expect(UTM(url, utm_source: 'pewpew')).to match(/utm_source=pewpew/)
|
@@ -52,21 +51,21 @@ describe UrchinTrackingModule do
|
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
55
|
-
it 'configures
|
56
|
-
|
57
|
-
expect(
|
54
|
+
it 'configures UrchinTrackingModule.source' do
|
55
|
+
UrchinTrackingModule.configure { |utm| utm[:utm_source]= EXAMPLE_CONFIG[:utm_source] }
|
56
|
+
expect(UrchinTrackingModule.source).to eq EXAMPLE_CONFIG[:utm_source]
|
58
57
|
end
|
59
58
|
|
60
|
-
it 'configures
|
61
|
-
|
62
|
-
expect(
|
59
|
+
it 'configures UrchinTrackingModule.medium' do
|
60
|
+
UrchinTrackingModule.configure { |utm| utm[:utm_medium]= EXAMPLE_CONFIG[:utm_medium] }
|
61
|
+
expect(UrchinTrackingModule.medium).to eq EXAMPLE_CONFIG[:utm_medium]
|
63
62
|
end
|
64
63
|
|
65
64
|
describe 'UTM helper' do
|
66
65
|
let(:utm) { double }
|
67
66
|
|
68
|
-
it 'invokes
|
69
|
-
|
67
|
+
it 'invokes UrchinTrackingModule' do
|
68
|
+
UrchinTrackingModule.should_receive(:new).with(url).and_return(utm)
|
70
69
|
utm.should_receive(:tracking).with(params)
|
71
70
|
UTM(url,params)
|
72
71
|
end
|