Sha256: 54aac44f9855b90d7c45c97aeab91822af27236ad7a879cdcd54b646b48ff7ec

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

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

class AdminAccountPermit < CanTango::AccountPermit
  def initialize ability
    super
  end

  protected

  def static_rules
    can :read, Article
  end
end


describe CanTango::PermitEngine::AccountPermit do
  let (:user) do
    User.new 'kris'
  end

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

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

  let (:permit) do
    AdminAccountPermit.new ability
  end

  describe 'attributes' do
    it "should be the permit for the :admin account" do
      permit.account_type.should == :admin
    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/account_permit_spec.rb