forked from railslove/rack-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle_adwords_conversion_spec.rb
More file actions
38 lines (33 loc) · 1.36 KB
/
google_adwords_conversion_spec.rb
File metadata and controls
38 lines (33 loc) · 1.36 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
RSpec.describe Rack::Tracker::GoogleAdwordsConversion do
def env
{
misc: 'foobar',
user_id: '123'
}
end
it 'will be placed in the body' do
expect(described_class.position).to eq({ body: :append })
expect(described_class.new(env).position).to eq({ body: :append })
expect(described_class.new(env, position: { head: :append }).position).to eq({ head: :append })
end
describe "with events" do
describe "default" do
def env
{'tracker' => {
'google_adwords_conversion' => [
{ 'class_name' => 'Conversion', 'id' => 123456, 'language' => 'en', 'format' => '3', 'color' => 'ffffff', 'label' => 'Conversion Label' }
]
}}
end
subject { described_class.new(env).render }
it 'will show events' do
expect(subject).to match(%r{var google_conversion_id = 123456;})
expect(subject).to match(%r{var google_conversion_language = 'en';})
expect(subject).to match(%r{var google_conversion_format = '3';})
expect(subject).to match(%r{var google_conversion_color = 'ffffff';})
expect(subject).to match(%r{var google_conversion_label = 'Conversion Label';})
expect(subject).to match(%r{<img.*src=\"\/\/www.googleadservices.com\/pagead\/conversion\/123456\/\?label=Conversion%20Label&guid=ON&script=0\"/>})
end
end
end
end