Sha256: c1585205bbe68327c8a6a1ef2bb96551093c30db2d076f1c21874dc0b3ab56a3

Contents?: true

Size: 1.36 KB

Versions: 16

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

module Workarea
  module Api
    module Storefront
      class MenusIntegrationTest < IntegrationTest
        include Workarea::Storefront::IntegrationTest

        setup :set_navigation_menu

        def set_navigation_menu
          @menus = ['Men', 'Women', 'Children'].map do |name|
            first_level = create_taxon(
              name: name,
              url: "http://example.com/#{name.downcase}"
            )

            second_level = first_level.children.create!(name: 'Sale')

            menu = create_menu(taxon: first_level)

            content = Content.for(menu)
            content.blocks.create!(
              type: 'taxonomy',
              data: { 'start' => second_level.id }
            )

            menu
          end

          @menu = @menus.first
        end

        def test_lists_menus
          get storefront_api.menus_path
          result = JSON.parse(response.body)

          assert_equal(@menus.count, result['menus'].count)
        end

        def test_shows_menus
          get storefront_api.menu_path(@menu)
          result = JSON.parse(response.body)

          result_block = result['content_blocks'].first
          assert_equal(@menu.id.to_s, result['id'])
          assert_equal(1, result['content_blocks'].count)
          assert_equal('taxonomy', result_block['type'])
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

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