Sha256: 415c6cf34ea6ed0cab1f6494c3cb4aa1a298ceda6e5ea706859d8561d4a6280e

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

require 'test_helper'

module Workarea
  module Api
    module Storefront
      class TaxonsIntegrationTest < IntegrationTest
        setup :set_taxons

        def set_taxons
          @taxon = create_taxon(
            name: 'Mens',
            url: 'http://example.com/pages/mens'
          )

          @taxon.children.create!(name: 'Sale')
        end

        def test_show
          get storefront_api.taxon_path(@taxon)
          result = JSON.parse(response.body)

          assert_equal(@taxon.id.to_s, result['taxon']['id'])
          assert_equal(
            'http://example.com/pages/mens',
            result['taxon']['navigable_url']
          )

          assert_equal(1, result['children'].size)
        end

        def test_inactive_taxon
          @taxon.update_attributes!(
            url: nil,
            navigable: create_page(active: false)
          )

          get storefront_api.taxon_path(@taxon)
          refute(response.ok?)
          assert_equal(404, response.status)
        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/taxons_integration_test.rb
workarea-api-storefront-4.5.6 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.5.5 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.5.5 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.5.4 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.5.4 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.5.3 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.5.3 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.5.2 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.5.2 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.5.0 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.5.0 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.4.7 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.4.7 test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-4.4.6 storefront/test/integration/workarea/api/storefront/taxons_integration_test.rb
workarea-api-storefront-4.4.6 test/integration/workarea/api/storefront/taxons_integration_test.rb