Sha256: 32f997e4fe1895b3a6b275d5349af83ddb96aeb247035d9dbb3dd5cec68f4e5d

Contents?: true

Size: 1.67 KB

Versions: 16

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'
require 'workarea/api/documentation_test'

module Workarea
  module Api
    module Storefront
      class AnalyticsDocumentationTest < DocumentationTest
        resource 'Analytics'

        def test_and_document_saving_a_category_view
          description 'saving a category view'
          route storefront_api.analytics_category_view_path(category_id: ':category_id')
          explanation 'saving a category view will be reflected in admin reports'

          record_request do
            post storefront_api.analytics_category_view_path(category_id: '12345')
            assert_equal(200, response.status)
          end
        end

        def test_and_document_saving_a_product_view
          description 'saving a product view'
          route storefront_api.analytics_product_view_path(product_id: ':product_id')
          explanation 'saving a product view will be reflected in admin reports'

          record_request do
            post storefront_api.analytics_product_view_path(product_id: '12345')
            assert_equal(200, response.status)
          end
        end

        def test_and_document_saving_a_search
          description 'Saving a search'
          route storefront_api.analytics_search_path
          explanation <<-EOS
            Saving a search will be reflected in admin reports. This is intended
            to be called once per search performed by a customer.
          EOS

          record_request do
            post storefront_api.analytics_search_path,
                  as: :json,
                  params: { q: 'foo', total_results: 5 }

            assert_equal(200, response.status)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.6 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.5.5 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.5 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.5.4 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.4 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.5.3 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.3 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.5.2 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.2 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.5.0 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.5.0 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.4.7 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.4.7 test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-4.4.6 storefront/test/documentation/workarea/api/storefront/analytics_documentation_test.rb
workarea-api-storefront-4.4.6 test/documentation/workarea/api/storefront/analytics_documentation_test.rb