Sha256: c6803c301c32f98071d970b27fdaf166f601ebb0c1dd75406f2224232950ac61
Contents?: true
Size: 1.54 KB
Versions: 39
Compression:
Stored size: 1.54 KB
Contents
require 'test_helper' class AbilityTest < ActiveSupport::TestCase fixtures :all def test_superuser_permission ability = Ability.new(adminpanel_users(:valid)) assert ability.can?(:manage, :all) end def test_read_permission ability = Ability.new(adminpanel_users(:reader)) assert ability.can?(:read, Adminpanel::Product) assert ability.cannot?(:destroy, Adminpanel::Product) assert ability.cannot?(:update, Adminpanel::Product) assert ability.cannot?(:create, Adminpanel::Product) end def test_create_permission ability = Ability.new(adminpanel_users(:creator)) assert ability.cannot?(:destroy, Adminpanel::Product) assert ability.cannot?(:update, Adminpanel::Product) assert ability.can?(:create, Adminpanel::Product) end def test_delete_permission ability = Ability.new(adminpanel_users(:deleter)) assert ability.can?(:destroy, Adminpanel::Product) assert ability.cannot?(:update, Adminpanel::Product) assert ability.cannot?(:create, Adminpanel::Product) end def test_updater_permission ability = Ability.new(adminpanel_users(:updater)) assert ability.cannot?(:destroy, Adminpanel::Product) assert ability.can?(:update, Adminpanel::Product) assert ability.cannot?(:create, Adminpanel::Product) end def test_superuser_permission ability = Ability.new(adminpanel_users(:superuser)) assert ability.cannot?(:destroy, Adminpanel::Product) assert ability.can?(:update, Adminpanel::Product) assert ability.can?(:create, Adminpanel::Product) end end
Version data entries
39 entries across 39 versions & 1 rubygems