Sha256: 4a2f00d73123e7d5fa67ac89f647abf4357c18975dda2fa44a8858dec3671851

Contents?: true

Size: 987 Bytes

Versions: 21

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

CanTango.config.cache_engine.set :off
class AdminsRoleGroupPermit < CanTango::RoleGroupPermit
  def initialize ability
    super
  end

  protected

  def static_rules
  end
end

class AdminRolePermit < CanTango::RolePermit
  def initialize ability
    super
  end

  protected

  def static_rules
  end
end


describe CanTango::Permits::RolePermit::Builder do
  let (:user) do
    User.new 'kris'
  end

  let (:user_account) do
    ua = UserAccount.new user, :role_groups => [:admins], :roles => [:admin]
    user.account = ua
  end

  let (:ability) do
    CanTango::Ability.new user_account
  end

  let (:builder) do
    CanTango::Permits::RolePermit::Builder.new ability
  end

  describe 'attributes' do
    it "should have an ability" do
      builder.ability.should be_a(CanTango::Ability)
    end
  end

  describe '#build' do
    it 'should build a list of permits' do
      builder.build.should_not be_empty
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4.6 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4.5 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4.3 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4.2 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4.1 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.4 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.9.3.2 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9.5 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9.4 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9.3 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9.2 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9.1 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.9 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.8.1 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.8 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.7 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.6.2 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.6.1 spec/cantango/permit_engine/builder/role_permits_spec.rb
cantango-0.8.6 spec/cantango/permit_engine/builder/role_permits_spec.rb