Sha256: 9eb2b51621e0489dc0ec06e768453940107475b2497a9c452900a2f7d9008064

Contents?: true

Size: 667 Bytes

Versions: 7

Compression:

Stored size: 667 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

module CanTango::Ability
  class Base
    include CanTango::Ability::Helper::Account
    
    def permit_rules
      can :read, Project
      cannot :edit, Project
    end
  end
end

describe CanTango::Scope::Ability do
  before do
    @user = User.new 'krisy', 'kris@gmail.com'
    @ability = CanTango::Ability::Base.new @user
    
    @project = Project.new
  end
  
  subject { CanTango::Scope::Ability.new @ability }
  
  specify do
    subject.can?(:read, @project).should be_true
  end

  specify do
    subject.cannot?(:edit, @project).should be_true
    subject.can?(:edit, @project).should be_false
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cantango-core-0.1.9 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.8 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.7 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.6 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.5 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.4 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.3 spec/cantango/scope/ability_spec.rb