Sha256: 6fef6d4a083148d46bf91eeea8e432c2a4b25ed94da9d80113e7afd3a517e5ef

Contents?: true

Size: 1.41 KB

Versions: 27

Compression:

Stored size: 1.41 KB

Contents

require 'test_helper'

module Workarea
  class Segment
    module Rules
      class TrafficReferrerTest < TestCase
        def test_qualifies?
          visit = create_visit
          refute(TrafficReferrer.new.qualifies?(visit))

          visit = create_visit('HTTP_REFERER' => 'http://workarea.com/')
          refute(TrafficReferrer.new.qualifies?(visit))

          visit = create_visit('HTTP_REFERER' => 'https://www.google.com/')
          assert(TrafficReferrer.new(source: %w(Google)).qualifies?(visit))
          refute(TrafficReferrer.new(source: %w(Yahoo!)).qualifies?(visit))
          assert(TrafficReferrer.new(medium: 'Search').qualifies?(visit))
          refute(TrafficReferrer.new(medium: 'Social').qualifies?(visit))
          assert(TrafficReferrer.new(url: 'google').qualifies?(visit))
          refute(TrafficReferrer.new(url: 'twitter').qualifies?(visit))

          visit = create_visit('HTTP_REFERER' => 'https://www.facebook.com/')
          assert(TrafficReferrer.new(source: %w(Facebook)).qualifies?(visit))
          refute(TrafficReferrer.new(source: %w(Google)).qualifies?(visit))
          assert(TrafficReferrer.new(medium: 'Social').qualifies?(visit))
          refute(TrafficReferrer.new(medium: 'Search').qualifies?(visit))
          assert(TrafficReferrer.new(url: 'www').qualifies?(visit))
          refute(TrafficReferrer.new(url: 'facebook$').qualifies?(visit))
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.26 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.25 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.23 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.22 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.21 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.20 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.19 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.18 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.17 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.16 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.15 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.14 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.13 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.12 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.11 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.10 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.9 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.8 test/models/workarea/segment/rules/traffic_referrer_test.rb
workarea-core-3.5.7 test/models/workarea/segment/rules/traffic_referrer_test.rb