Sha256: c43fa1e1eaf28ad459ff3b314013fefbdd1c098d82bc0f57bbf3b23d7684b38d

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

require 'support/capybara_app_helper'

RSpec.describe "Facebook Integration" do
  before do
    setup_app(action: :google_analytics) do |tracker|
      tracker.handler :google_analytics, { tracker: 'U-XXX-Y' }
    end
    visit '/'
  end

  subject { page }

  it "embeds the script tag with tracking event from the controller action" do
    expect(page).to have_content('ga("ecommerce:addItem",{"id":"1234","name":"Fluffy Pink Bunnies","sku":"DD23444","category":"Party Toys","price":"11.99","quantity":"1"})')
    expect(page).to have_content('ga("ecommerce:addTransaction",{"id":"1234","affiliation":"Acme Clothing","revenue":"11.99","shipping":"5","tax":"1.29"})')
    expect(page).to have_content('ga("send",{"hitType":"event","eventCategory":"button","eventAction":"click","eventLabel":"nav-buttons","eventValue":"X"})')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-tracker-0.3.0 spec/integration/google_analytics_integration_spec.rb
rack-tracker-0.2.6 spec/integration/google_analytics_integration_spec.rb
rack-tracker-0.2.5 spec/integration/google_analytics_integration_spec.rb