Sha256: 09bce3b1f2fa2caf8a4afdf12050a38b97206a72d3f90543ab2b9fa04378cd93

Contents?: true

Size: 1.11 KB

Versions: 23

Compression:

Stored size: 1.11 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' => [
            { 'class_name' => 'VisitorName', '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' => [
            { 'class_name' => 'VisitorInfo', '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

23 entries across 23 versions & 1 rubygems

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