Sha256: 698b84cf0f041f90d808399c9a6007b047228741ce714725aa20a8bd74652548

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 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_text('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

7 entries across 7 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.26 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.25 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.23 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.22 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.21 test/system/workarea/admin/trash_system_test.rb
workarea-admin-3.5.20 test/system/workarea/admin/trash_system_test.rb