Sha256: a988f25fee0ec4c2c1358be0c92e3def7388f904a05853e38183ce247e502f50

Contents?: true

Size: 1.9 KB

Versions: 50

Compression:

Stored size: 1.9 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class AssetsSystemTest < SystemTest
      include Admin::IntegrationTest

      def test_management
        visit admin.content_assets_path
        click_link 'add_asset'

        fill_in 'asset[name]', with: 'Test Asset'
        attach_file 'asset[file]', product_image_file_path
        click_button 'create_asset'
        assert(page.has_content?('Success'))
        assert(page.has_content?('Test Asset'))

        click_link 'Attributes'
        fill_in 'asset[name]', with: 'Edited Asset'
        click_button 'save_asset'
        assert(page.has_content?('Success'))
        assert(page.has_content?('Edited Asset'))

        click_link '↑ All assets'
        click_link 'Edited Asset'
        click_link 'Delete'

        assert_current_path(admin.content_assets_path)
        assert(page.has_content?('Success'))
        refute(page.has_content?('Edited Asset'))
      end

      def test_insertion
        asset = create_asset

        content = create_content(
          contentable: create_page,
          blocks: [
            { type: 'hero', data: { asset: asset.id } }
          ]
        )

        visit admin.edit_content_path(content)
        find('.content-block').click

        find('.asset-picker-field a').click
        within '#takeover' do
          click_link 'Test Asset'
        end

        within '.asset-picker-field' do
          assert(page.has_content?('Test Asset'))
        end
      end

      def test_clearing
        asset = create_asset

        content = create_content(
          contentable: create_page,
          blocks: [
            { type: 'hero', data: { asset: asset.id } }
          ]
        )

        visit admin.edit_content_path(content)
        find('.content-block').click
        assert(page.has_content?('Test Asset'))

        click_button 'Clear asset'
        assert(page.has_content?('(none)'))
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
workarea-admin-3.4.45 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.44 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.43 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.42 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.41 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.19 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.40 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.18 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.39 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.17 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.38 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.16 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.37 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.15 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.36 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.14 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.35 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.13 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.34 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.12 test/system/workarea/admin/assets_system_test.rb