Sha256: ff612dac21abf7adaf207371734524e97c7d07cd9aaf7f88c217859b0eace4f3

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

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

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

  protected

  def static_rules
    can :read, Article
    can :write, Post
    can :create, Comment
    :break
  end
end

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

  let (:user_account) do
    ua = UserAccount.new user
    user.account = ua
  end

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

  let (:permit) do
    SystemRolePermit.new ability
  end

  let (:executor) do
    CanTango::PermitEngine::Executor::System.new permit
  end

  before(:each) do
    CanTango.config.permits.set :on
  end

  describe '#execute!' do
    before:each do
      CanTango.config.permits.set :on
    end

    describe 'should execute permit' do
      # specify { ability.should be_allowed_to(:read, Article) }
      # specify { ability.should be_allowed_to(:write, Post) }
      # specify { ability.should be_allowed_to(:create, Comment) }

      specify { lambda{ executor.execute! }.should_not raise_error }
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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