Sha256: e75adfb8e484b204a8007a71d0d6961a736effe8f023d1d4e3ef0ca420b40e45
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
RSpec.describe Rack::Tracker::FacebookPixel do def env {} end it 'will be placed in the body' do expect(described_class.position).to eq(:body) expect(described_class.new(env).position).to eq(:body) end describe 'with id' do subject { described_class.new(env, id: 'PIXEL_ID').render } it 'will push the tracking events to the queue' do expect(subject).to match(%r{fbq\('init', 'PIXEL_ID'\)}) end it 'will add the noscript fallback' do expect(subject).to match(%r{https://www.facebook.com/tr\?id=PIXEL_ID&ev=PageView&noscript=1}) end end describe 'with events' do def env { 'tracker' => { 'facebook_pixel' => [ { 'type' => 'Purchase', 'class_name' => 'Track', 'options' => { 'value' => '23', 'currency' => 'EUR' } },{ 'type' => 'FrequentShopper', 'class_name' => 'TrackCustom', 'options' => { 'purchases' => 8, 'category' => 'Sport' } } ] } } end subject { described_class.new(env).render } it 'will push the tracking events to the queue' do expect(subject).to match(%r{"track", "Purchase", \{"value":"23","currency":"EUR"\}}) expect(subject).to match(%r{"trackCustom", "FrequentShopper", \{"purchases":8,"category":"Sport"\}}) end it 'will add the noscript fallback' do expect(subject).to match(%r{https://www.facebook.com/tr\?id=&ev=PageView&noscript=1}) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-tracker-1.5.0 | spec/handler/facebook_pixel_spec.rb |