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.33 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.11 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.10 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.32 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.9 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.8 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.7 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.6 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.5 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.4 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.26 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.3 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.25 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.2 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.24 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.1 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.23 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.22 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.5.0 test/system/workarea/admin/assets_system_test.rb
workarea-admin-3.4.21 test/system/workarea/admin/assets_system_test.rb