Sha256: 397beb3c5fefed865f754e01963074715416f5825f1f9d7d04c33cb7dd9be6ab

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 Bytes

Contents

require "mongoid/strategy_helper"

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

module UserSetup
  def find_role name
    Role.where(:name => name.to_sym).first
  end

  def create_no_roles_user
    Factory.create :user, :name => 'no roles', :trole => nil
  end

  def create_user
    Factory.create :user, :name => 'normal', :trole => find_role(:user)
  end

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


require 'troles/common/api_spec' # Common API examples  

describe 'Troles strategy :ref_one' do
  it_should_behave_like "Common API"
  # it_should_behave_like "Troles API"  
end    

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
troles-0.6.1 spec/mongoid/strategies/one/ref_one_spec.rb
troles-0.6.0 spec/mongoid/strategies/one/ref_one_spec.rb
troles-0.5.2 spec/mongoid/strategies/one/ref_one_spec.rb
troles-0.5.1 spec/mongoid/strategies/one/ref_one_spec.rb
troles-0.5.0 spec/mongoid/strategies/one/ref_one_spec.rb