Sha256: 83e74d230801445fb633417ca764e0f28f589859a56082d344d1987d27c8d63b

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

RSpec.describe Rack::Tracker::Bing do

  it 'will be placed in the body' do
    expect(described_class.position).to eq(:body)
  end

  describe "with events" do
    subject { described_class.new(env, tracker: 'somebody').render }

    describe "default" do
      def env
        {'tracker' => {
          'bing' => [
            { 'class_name' => 'Conversion', 'category' => 'Users', 'action' => 'Login', 'label' => 'Standard', 'value' => 10 }
          ]
        }}
      end

      it "will show event initialiser" do
        expect(subject).to include "window.uetq = window.uetq || [];"
      end

      it "will show events" do
        expect(subject).to include "window.uetq.push({ 'ec': 'Users', 'ea': 'Login', 'el': 'Standard', 'ev': 10 });"
      end
    end
  end

  describe "with multiple events" do
    subject { described_class.new(env, tracker: 'somebody').render }

    describe "default" do
      def env
        {'tracker' => {
          'bing' => [
            { 'class_name' => 'Conversion', 'category' => 'Users', 'action' => 'Login', 'label' => 'Standard', 'value' => 10 },
            { 'class_name' => 'Conversion', 'category' => 'Users', 'action' => 'Logout', 'label' => 'Standard', 'value' => 5 }
          ]
        }}
      end

      it "will show event initialiser" do
        expect(subject).to include "window.uetq = window.uetq || [];"
      end

      it "will show events" do
        expect(subject).to include "window.uetq.push({ 'ec': 'Users', 'ea': 'Login', 'el': 'Standard', 'ev': 10 });"
        expect(subject).to include "window.uetq.push({ 'ec': 'Users', 'ea': 'Logout', 'el': 'Standard', 'ev': 5 });"
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rack-tracker-1.13.0 spec/handler/bing_spec.rb
rack-tracker-1.12.1 spec/handler/bing_spec.rb
rack-tracker-1.12.0 spec/handler/bing_spec.rb
rack-tracker-1.11.2 spec/handler/bing_spec.rb
rack-tracker-1.11.1 spec/handler/bing_spec.rb
rack-tracker-1.11.0 spec/handler/bing_spec.rb
rack-tracker-1.10.0 spec/handler/bing_spec.rb
rack-tracker-1.9.0 spec/handler/bing_spec.rb