Sha256: 96e644b8d49c1d5dddf27ccd1eaa8be4af3673a5ac6a4c520ee8fca44e2deebf

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

RSpec.describe Rack::Tracker::GoSquared do

  def env
    {misc: 'foobar'}
  end

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

  describe "with events" do
    describe "visitor name" do
      def env
        {'tracker' => {
          'go_squared' => [
            Rack::Tracker::GoSquared::VisitorName.new(name: "John Doe")
          ]
        }}
      end

      subject { described_class.new(env, tracker: '12345').render }

      it "will show the right name" do
        expect(subject).to match(%r{_gs\(\"set\",\"visitorName\",\"John Doe\"\)})
      end
    end

    describe "visitor details" do
      def env
        {'tracker' => {
          'go_squared' => [
            Rack::Tracker::GoSquared::VisitorInfo.new(age: 35, favorite_food: 'pizza')
          ]
        }}
      end

      subject { described_class.new(env, tracker: '12345').render }

      it "will show the right properties" do
        expect(subject).to match(%r{_gs\(\"set\",\"visitor\",{\"age\":35,\"favorite_food\":\"pizza\"}\)})
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rack-tracker-0.3.0 spec/handler/go_squared_spec.rb
rack-tracker-0.2.6 spec/handler/go_squared_spec.rb
rack-tracker-0.2.5 spec/handler/go_squared_spec.rb
rack-tracker-0.2.4 spec/handler/go_squared_spec.rb
rack-tracker-0.2.3 spec/handler/go_squared_spec.rb
rack-tracker-0.2.2 spec/handler/go_squared_spec.rb
rack-tracker-0.2.1 spec/handler/go_squared_spec.rb
rack-tracker-0.2.0 spec/handler/go_squared_spec.rb