Sha256: e74a3091410578722a12249650ba6be3dcbb76a6ff1f2c1a0c2ef92a265bbdd0

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'support/metal_controller'
require 'support/fake_handler'

RSpec.describe "Facebook Integration" do
  before do
    Capybara.app = Rack::Builder.new do
      use Rack::Tracker do
        handler :google_analytics, { tracker: 'U-XXX-Y' }
      end
      run MetalController.action(:google_analytics)
    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","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

1 entries across 1 versions & 1 rubygems

Version Path
rack-tracker-0.1.3 spec/integration/google_analytics_integration_spec.rb