Sha256: f21c170b87a0c75b5a686d17ec9ab98b7bf9295289746d92a02ba4fd86a7b9af
Contents?: true
Size: 951 Bytes
Versions: 14
Compression:
Stored size: 951 Bytes
Contents
RSpec.describe Rack::Tracker::GoogleTagManager do def env { misc: 'foobar', user_id: '123' } end describe "with events" do describe "default" do def env {'tracker' => { 'google_tag_manager' => [ { 'class_name' => 'Push', 'page' => 'Cart', 'price' => 50, 'content_ids' => ['sku_1', 'sku_2', 'sku_3'] } ] }} end subject { described_class.new(env, container: 'somebody').render_head } it "will show events" do expect(subject).to match(%r{"page":"Cart","price":50,"content_ids":\["sku_1","sku_2","sku_3"\]}) end end end describe "with dynamic tracker" do subject { described_class.new(env, { container: lambda { |env| return env[:misc] }}).render_head } it 'will call tracker lambdas to obtain tracking codes' do expect(subject).to match(%r{\(window,document,'script','dataLayer','foobar'\)}) end end end
Version data entries
14 entries across 14 versions & 1 rubygems