Sha256: 09c5d50785b27893b0b86df6e1fa9a51e2bc605e114fb99f757b2a435f0c014f

Contents?: true

Size: 1.64 KB

Versions: 22

Compression:

Stored size: 1.64 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')

        Configuration::ContentBlocks.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 = block.to_draft.tap(&:save!)
        get storefront.draft_content_block_path(draft)
        assert(response.ok?)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.26 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.25 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.23 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.22 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.21 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.20 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.19 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.18 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.17 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.16 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.15 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.14 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.13 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.12 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.11 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.10 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.9 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.8 test/integration/workarea/storefront/content_blocks_integration_test.rb
workarea-storefront-3.5.7 test/integration/workarea/storefront/content_blocks_integration_test.rb