Sha256: 1c6fbf11a3913509fe576221990c4f08ddbeb05add5d583ed043ad57dcefed8d

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

require 'spec_helper'
require 'fixtures/models'

class AdminPermit < CanTango::UserPermit
  def initialize ability
    super
  end

  protected

  def static_rules
    can :read, Article
  end
end


describe CanTango::Permits::UserPermit do
  let (:user) do
    User.new 'kris'
  end

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

  let (:permit) do
    AdminPermit.new ability
  end

  describe 'attributes' do
    it "should be the permit for the :admin user" do
      permit.user_type.should == :admin
    end

    it "should have an ability" do
      permit.ability.should be_a(CanTango::Ability)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cantango-0.8.8.1 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.8 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.7 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.6.2 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.6.1 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.6 spec/cantango/permit_engine/user_permit_spec.rb
cantango-0.8.5.1 spec/cantango/permit_engine/user_permit_spec.rb