Sha256: 897ce3038ea3ed59f8c1b70b78777981a76e16ba1438ecd4d0f566bb605794d5

Contents?: true

Size: 968 Bytes

Versions: 34

Compression:

Stored size: 968 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class AnalyticsIntegrationTest < Workarea::IntegrationTest
      def test_saving_product_view
        post storefront.analytics_product_view_path(product_id: 'foo')
        assert_equal(1, Metrics::ProductByDay.first.views)
      end

      def test_saving_search
        post storefront.analytics_search_path(q: 'foo', total_results: '5')

        insights = Metrics::SearchByDay.first
        assert_equal(1, insights.searches)
        assert_equal(5, insights.total_results)
      end

      def test_saving_category_view
        post storefront.analytics_category_view_path(category_id: 'foo')
        assert_equal(1, Metrics::CategoryByDay.first.views)
      end

      def test_blocking_bots
        post storefront.analytics_product_view_path(product_id: 'foo'),
          headers: { 'HTTP_USER_AGENT' => 'Googlebot' }

        assert(Metrics::ProductByDay.count.zero?)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-storefront-3.4.45 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.44 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.43 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.42 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.41 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.40 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.39 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.38 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.37 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.36 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.35 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.34 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.33 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.32 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.31 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.30 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.29 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.28 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.27 test/integration/workarea/storefront/analytics_integration_test.rb
workarea-storefront-3.4.26 test/integration/workarea/storefront/analytics_integration_test.rb