Sha256: 289d9f7221217ab88eb6cb44869cff071e2e1b00ea0a5d063c11428226ef5b8b

Contents?: true

Size: 873 Bytes

Versions: 5

Compression:

Stored size: 873 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 :facebook, { custom_audience: 'my-audience' }
      end
      run MetalController.action(:facebook)
    end

    visit '/'
  end

  subject { page }

  it "embeds the script tag with tracking event from the controller action" do
    expect(page).to have_content('window._fbq.push(["addPixelId", "my-audience"]);')
    expect(page.body).to include('https://www.facebook.com/tr?id=my-audience&ev=PixelInitialized')
    expect(page).to have_content('window._fbq.push(["track","conversion-event",{"value":"1","currency":"EUR"}]);')
    expect(page.body).to include('https://www.facebook.com/offsite_event.php?id=conversion-event&value=1&currency=EUR')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rack-tracker-0.1.3 spec/integration/facebook_integration_spec.rb
rack-tracker-0.1.1 spec/integration/facebook_integration_spec.rb
rack-tracker-0.1.0 spec/integration/facebook_integration_spec.rb
rack-tracker-0.0.4 spec/integration/facebook_integration_spec.rb
rack-tracker-0.0.3 spec/integration/facebook_integration_spec.rb