Sha256: cdc6ea42c86a17dc4f76efbc33b19e1e13176cb2034af4c21b11aafc241200a4

Contents?: true

Size: 962 Bytes

Versions: 21

Compression:

Stored size: 962 Bytes

Contents

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

describe CanTango::PermissionEngine::Permission do
  before(:all) do
    @permission = CanTango::PermissionEngine::Permission.new :bloggers
  end

  subject do
    reads = ['Article' , 'Comment']
    writes = ['Article' , 'Post']
    @permission.static_rules.can = {:read => reads}
    @permission.static_rules.cannot = {:write => writes}
    @permission
  end

  its(:name) { should == :bloggers }

  context 'static rules' do
    subject { @permission.static_rules} 
    it { should include('can') }
    its(:can) { should include('read')}
    its(:cannot) { should include('write')}
  end

  context 'compiled rules' do
    subject { @permission.compiled_rules} 
    it { should include('can')}
    it { should include('cannot')}
    its(:can) { should == %|can(:read, Article)\ncan(:read, Comment)|}
    its(:cannot) { should == %|cannot(:write, Article)\ncannot(:write, Post)|}
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

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