Top Level Namespace

Defined Under Namespace

Modules: AdminRoleCheck, RoleStrategy, Roles, RolesGeneric Classes: Role, String, Symbol

Instance Method Summary collapse

Instance Method Details

#default_user_setupObject



1
2
3
4
5
# File 'lib/roles_generic/rspec/user_setup.rb', line 1

def default_user_setup
  @admin_user   = User.new 'Admin user',  :admin
  @normal_user  = User.new 'Normal user', :user, :guest    
  @guest_user   = User.new 'Guest user',  :guest   
end

#use_roles_strategy(strategy) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/roles_generic/strategy.rb', line 42

def use_roles_strategy strategy
  cardinality = Roles::Strategy.cardinality(strategy)  
  require "roles_generic/strategy/#{cardinality}/#{strategy}"
  require "roles_generic/admin" if strategy =~ /admin/

  gem_name = Roles::Strategy.gem_name
  prefix = Roles::Strategy.embedded?(strategy) ? 'embedded_' : ''
  require "#{gem_name}/#{prefix}role" if !Roles::Strategy.inline_strategy?(strategy)  
  require "#{gem_name}/strategy/#{cardinality}/#{strategy}"
end