Sha256: 414c355f08967e785331f270eab2a0dc561a5cc5256b31303e3b1c84e1a1ec80

Contents?: true

Size: 1.52 KB

Versions: 55

Compression:

Stored size: 1.52 KB

Contents

require 'test_helper'

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

      def test_restoring_from_trash
        category = create_category(name: 'My Category')

        visit admin.catalog_category_path(category)
        click_link t('workarea.admin.catalog_categories.show.delete')

        visit admin.trash_index_path
        assert(page.has_content?('My Category'))

        click_link t('workarea.admin.activities.restore')
        assert_current_path(admin.catalog_category_path(category))
        assert(page.has_content?('Success'))
        assert(page.has_content?('My Category'))

        visit admin.trash_index_path
        refute(page.has_content?('My Category'))
      end

      def test_restore_permission
        user = create_user(
          email: 'test@workarea.com',
          admin: true,
          catalog_access: true,
          can_restore: false
        )
        set_current_user(user)

        category = create_category(name: 'My Category')

        visit admin.catalog_category_path(category)
        click_link t('workarea.admin.catalog_categories.show.delete')

        visit admin.trash_index_path
        assert(page.has_no_content?(t('workarea.admin.activities.restore')))

        user.update_attributes(can_restore: true)

        visit admin.trash_index_path

        click_link t('workarea.admin.activities.restore')
        assert_current_path(admin.catalog_category_path(category))
        assert(page.has_content?('Success'))
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

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