Sha256: c7a317924351a3443c24a3b647beb94cde2f78fbcea389595395393fd20fbc80

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 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::PermitEngine::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

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 spec/cantango/permit_engine/role_group_permit_spec.rb