Sha256: 0dedaf72980afa30b12ffdee3a11e3418488a5b076fcb60474e8f879175d7df2

Contents?: true

Size: 967 Bytes

Versions: 7

Compression:

Stored size: 967 Bytes

Contents

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

def config_folder
  File.dirname(__FILE__)+ "/../fixtures/config/"
end

CanTango.configure do |config|
  config.clear!
  config.engines.all :off
  config.engine(:permission).set :on
  config.ability.mode = :cache
  config.engine(:permission) do |engine|
    engine.mode = :cache
    engine.config_path(config_folder)
  end
  config.debug!
end

describe CanTango::PermissionEngine do
  context 'cache' do
    let (:ability) do
      CanTango::CachedAbility.new @user
    end

    before do
      @user = User.new 'kris'
    end

    subject { CanTango::PermissionEngine.new ability }

    describe '#execute!' do
      before do
        subject.execute!
      end

      it 'engine should have rules' do
        subject.rules.should_not be_empty
      end

      it 'engine cache should be empty' do
          subject.cache.empty?.should_not be_true
      end
    end
  end
end



Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4.6 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4.5 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4.3 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4.2 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4.1 spec/cantango/permission_engine_cached_spec.rb
cantango-0.9.4 spec/cantango/permission_engine_cached_spec.rb