Sha256: d3bdc3765cd21e7bbcbb408f6c848f7b179f17be1310fe1eddd51e2be88bafa9

Contents?: true

Size: 670 Bytes

Versions: 3

Compression:

Stored size: 670 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

module CanTango::Ability
  class Base
    include CanTango::Ability::Helper::Account
    
    def calculate_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

3 entries across 3 versions & 1 rubygems

Version Path
cantango-core-0.1.9.3 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.9.2 spec/cantango/scope/ability_spec.rb
cantango-core-0.1.9.1 spec/cantango/scope/ability_spec.rb