Sha256: 05e09968f76b3c43d28af03254df4c19efd33f1b6a3ebd0878b744c3abc7e3a2

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

require 'strategy_helper'

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


module UserSetup
  def create_role name
    Role.create(name)
  end

  def create_no_roles_user
    Factory.create :user, :name => 'no roles', :troles => []
  end

  def create_user
    Factory.create :user, :name => 'normal', :troles => [ create_role(:user) ]
  end

  def create_admin_user
    Factory.create :user, :name => 'admin', :troles => [ create_role(:admin) ]
  end

  def create_complex_user
    Factory.create :user, :name => 'user and admin', :troles => [ create_role(:name => :user), create_role(:name => :admin) ]
  end
end

describe 'Troles strategy embed_many' do
  it_behaves_like "Common API"
  it_behaves_like "Common API for multiple roles"  

  it_behaves_like "Troles API"  
end    

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troles-0.5.1 spec/troles/strategies/embed_many_spec.rb
troles-0.5.0 spec/troles/strategies/embed_many_spec.rb