Sha256: 2a58f3023d1cd373086b5f662d718ee1551d4d1dfb70f832a5c84688d97c650c
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require 'support/capybara_app_helper' RSpec.describe "Google Global Integration Integration" do before do setup_app(action: :google_global) do |tracker| tracker.handler :google_global, tracker_options end visit '/' end let(:tracker_options) { { trackers: [{ id: 'U-XXX-Y' }] } } it "embeds the script tag with tracking event from the controller action" do expect(page.find("head")).to have_content('U-XXX-Y') end describe 'adjust tracker position via options' do let(:tracker_options) { { trackers: [{ id: 'U-XXX-Y' }], position: :body } } it "will be placed in the specified tag" do expect(page.find("head")).to_not have_content('U-XXX-Y') expect(page.find("body")).to have_content('U-XXX-Y') end end describe "handles empty tracker id" do let(:tracker_options) { { trackers: [{ id: nil }, { id: "" }, { id: " " }] } } it "does not inject scripts" do expect(page.find("head")).to_not have_content("<script async src='https://www.googletagmanager.com/gtag/js?id=") end end describe "callable tracker id" do let(:tracker_options) { { trackers: [{ id: proc { "U-XXX-Y" } }] } } it "is injected into head with id from proc" do expect(page.find("head")).to have_content('U-XXX-Y') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-tracker-1.13.0 | spec/integration/google_global_integration_spec.rb |
rack-tracker-1.12.1 | spec/integration/google_global_integration_spec.rb |