Sha256: 5f1b2d934f53e6ed16ccc75c3233a61bf5dce6f3a5a9855a7c04403c661270e1

Contents?: true

Size: 769 Bytes

Versions: 2

Compression:

Stored size: 769 Bytes

Contents

require 'strategy_helper'

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

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

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

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

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

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

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

  it_behaves_like "Trole API"  
end    

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troles-0.5.1 spec/trole/strategies/embed_one_spec.rb
troles-0.5.0 spec/trole/strategies/embed_one_spec.rb