Sha256: 4ffbd36f84d81bfa12479eeb14b69d72087a4b57109b40b816e8c98d0bd8129f

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

require 'trole/strategy_helper'

User.troles_strategy :ref_one do |c|
  c.valid_roles = [:user, :admin, :editor, :blogger]
end.configure!

Config.add_roles [:user, :admin, :editor, :blogger]

module UserSetup
  def create_no_roles
    Factory.create :user, :name => 'no roles', :trole => [ ]
  end

  def create_user
    Factory.create :user, :name => 'user', :trole => [ Role.where(:name => :user) ]
  end

  def create_admin_user
    Factory.create :user, :name => 'admin', :trole => [ Role.where(:name => :admin) ]
  end
end

describe 'Trole strategy ref_one' do
  it_behaves_like "Common API"
  it_behaves_like "Common API for multiple roles"  

  it_behaves_like "Trole API"  
end    

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troles-0.6.1 spec/trole/strategies/ref_one_spec.rb
troles-0.6.0 spec/trole/strategies/ref_one_spec.rb
troles-0.5.2 spec/trole/strategies/ref_one_spec.rb