Sha256: cda83ca9cbd9ba44e94d6409501fb93378cf9d808427acd03835a3eeac00126c

Contents?: true

Size: 1.71 KB

Versions: 34

Compression:

Stored size: 1.71 KB

Contents

require 'test_helper'

module Workarea
  module Storefront
    class ContentBlocksIntegrationTest < Workarea::IntegrationTest
      def test_content_blocks_render_with_defaults
        # For sample data
        create_asset
        create_taxon
        create_product
        create_category
        create_page

        content = Content.for('home_page')

        Workarea.config.content_block_types.each do |block_type|
          content.blocks.build(
            type: block_type.slug,
            data: block_type.defaults
          )
        end

        content.save!

        get storefront.root_path
        assert(response.ok?)
      end

      def test_previewing_new_content_block
        set_current_user(create_user(super_admin: true))

        get storefront.new_content_block_path(
          type_id: 'html',
          content_id: create_content.id
        )

        assert(response.ok?)
      end

      def test_showing_a_content_block
        set_current_user(create_user(super_admin: true))
        content = create_content
        block = content.blocks.build(
          type: :html,
          data: { 'html' => 'foo' }
        )
        content.save!

        get storefront.content_block_path(block)
        assert(response.ok?)
      end

      def test_showing_a_content_draft
        set_current_user(create_user(super_admin: true))
        content = create_content
        block = content.blocks.build(
          type: :html,
          data: { 'html' => 'foo' }
        )
        content.save!

        draft = Content::BlockDraft.create!(
          block.attributes.merge('content_id' => content.id)
        )

        get storefront.draft_content_block_path(draft)
        assert(response.ok?)
      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/content_blocks_integration_test.rb
workarea-storefront-3.4.44 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.43 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.42 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.41 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.40 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.39 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.38 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.37 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.36 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.35 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.34 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.33 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.32 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.31 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.30 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.29 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.28 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.27 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.4.26 test/integration/workarea/storefront/content_blocks_integration_test.rb