Sha256: 96c3ed10d8d13ac9ac3f362b0c336e1cc836ef408f84f1bb36c79ebaa9b46390

Contents?: true

Size: 830 Bytes

Versions: 11

Compression:

Stored size: 830 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

11 entries across 11 versions & 2 rubygems

Version Path
cantango-core-0.1.2 spec/cantango/rules_spec.rb
cantango-core-0.1.1 spec/cantango/rules_spec.rb
cantango-core-0.1.0 spec/cantango/rules_spec.rb
cantango-0.9.4.7 spec/cantango/rules_spec.rb
cantango-0.9.4.6 spec/cantango/rules_spec.rb
cantango-0.9.4.5 spec/cantango/rules_spec.rb
cantango-0.9.4.3 spec/cantango/rules_spec.rb
cantango-0.9.4.2 spec/cantango/rules_spec.rb
cantango-0.9.4.1 spec/cantango/rules_spec.rb
cantango-0.9.4 spec/cantango/rules_spec.rb
cantango-0.9.3.2 spec/cantango/rules_spec.rb