Sha256: 6277bca4a7689705bd3e2d6e0c9a530c83bdf5aac165614753530dbadc9cedaa

Contents?: true

Size: 848 Bytes

Versions: 14

Compression:

Stored size: 848 Bytes

Contents

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

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

  protected

  def static_rules
  end
end

def setup
  let (:user) do
    User.new 'kris'
  end

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

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

  let (:permit) do
    SystemRolePermit.new ability
  end  
  
  let (:executor) do    
    CanTango::PermitEngine::Executor::System.new permit, user_account
  end
end


describe CanTango::Rules do
  setup

  describe '#can' do
    it "should not have any rules" do
      permit.rules.should be_empty
    end
    
    it "should have rules after can" do
      permit.can :read, Comment
      permit.rules.should_not be_empty
    end    
  end  
end


Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cantango-0.8.9.5 spec/cantango/rules_spec.rb
cantango-0.8.9.4 spec/cantango/rules_spec.rb
cantango-0.8.9.3 spec/cantango/rules_spec.rb
cantango-0.8.9.2 spec/cantango/rules_spec.rb
cantango-0.8.9.1 spec/cantango/rules_spec.rb
cantango-0.8.9 spec/cantango/rules_spec.rb
cantango-0.8.8.1 spec/cantango/rules_spec.rb
cantango-0.8.8 spec/cantango/rules_spec.rb
cantango-0.8.7 spec/cantango/rules_spec.rb
cantango-0.8.6.2 spec/cantango/rules_spec.rb
cantango-0.8.6.1 spec/cantango/rules_spec.rb
cantango-0.8.6 spec/cantango/rules_spec.rb
cantango-0.8.5.1 spec/cantango/rules_spec.rb
cantango-0.8.0 spec/cantango/rules_spec.rb