Sha256: 8c18044ddf082f483428b53de261afe0db7993b43a4e06600f51fc34138e44b8

Contents?: true

Size: 1.84 KB

Versions: 31

Compression:

Stored size: 1.84 KB

Contents

require 'support/capybara_app_helper'

RSpec.describe "GoSquared Integration" do
  subject { page }

  before do
    setup_app(action: :go_squared) do |tracker|
      tracker.handler :go_squared, {
        tracker: '123456',
        anonymize_ip: true,
        cookie_domain: 'domain.com',
        use_cookies: true,
        track_hash: true,
        track_local: true,
        track_params: true
      }
    end
    visit '/'
  end

  it "adds the tracker to the page" do
    expect(page).to have_content("_gs('123456');")
  end

  it "adds the visitorName to the page" do
    expect(page).to have_content('_gs("set","visitorName","John Doe");')
  end

  it "adds the visitor to the page" do
    expect(page).to have_content('_gs("set","visitor",{"age":35,"favorite_food":"pizza"});')
  end

  it "sets anonymizeIp" do
    expect(page).to have_content("_gs('set', 'anonymizeIp', true);")
  end

  it "sets cookieDomain" do
    expect(page).to have_content("_gs('set', 'cookieDomain', 'domain.com');")
  end

  it "sets useCookies" do
    expect(page).to have_content("_gs('set', 'useCookies', true);")
  end

  it "sets trackHash" do
    expect(page).to have_content("_gs('set', 'trackHash', true);")
  end

  it "sets trackLocal" do
    expect(page).to have_content("_gs('set', 'trackLocal', true);")
  end

  it "sets trackParams" do
    expect(page).to have_content("_gs('set', 'trackParams', true);")
  end

  context 'multiple trackers are passed in' do
    before do
      setup_app(action: :go_squared) do |tracker|
        tracker.handler :go_squared, {
          trackers: { primaryTracker: '12345', secondaryTracker: '67890' }
        }
      end
      visit '/'
    end

    it "adds the tracker to the page" do
      expect(page).to have_content("_gs('12345', 'primaryTracker');")
      expect(page).to have_content("_gs('67890', 'secondaryTracker');")
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rack-tracker-1.13.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.12.1 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.12.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.11.2 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.11.1 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.11.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.10.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.9.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.8.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.7.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.6.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.5.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.4.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.3.1 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.3.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.2.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.1.0 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.0.2 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.0.1 spec/integration/go_squared_integration_spec.rb
rack-tracker-1.0.0 spec/integration/go_squared_integration_spec.rb