Sha256: b1e2fce88862da7d62b9f0b877574e8a456251dc14e5955d60c67fce5c44a46d

Contents?: true

Size: 789 Bytes

Versions: 13

Compression:

Stored size: 789 Bytes

Contents

require 'rspec'
require 'cantango'
require 'fixtures/models'

class AdminsRoleGroupPermit < CanTango::RoleGroupPermit
  def initialize ability
    super
  end

  protected

  def static_rules
  end
end

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

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

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

  describe 'attributes' do
    it "should be the permit for the :admins group" do
      permit.role_group.should == :admins
    end     

    it "should have an ability" do
      permit.ability.should be_a(CanTango::Ability)
    end     
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cantango-0.8.9.5 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.9.4 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.9.3 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.9.2 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.9.1 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.9 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.8.1 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.8 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.7 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.6.2 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.6.1 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.6 spec/cantango/permit_engine/role_group_permit_spec.rb
cantango-0.8.5.1 spec/cantango/permit_engine/role_group_permit_spec.rb