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.5.1 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.23 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.22 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.0 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.21 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.0.beta.1 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.20 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.19 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.18 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.17 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.16 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.15 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.14 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.13 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.4.12 test/system/workarea/admin/trash_system_test.rb