Sha256: b9be81160db3c76cb5d7302a305777a218a37b95c5f4c7d5893ddf8e62638515

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

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

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

  protected

  def static_rules
    can :read, Article
  end
end


describe CanTango::PermitEngine::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

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 spec/cantango/permit_engine/user_permit_spec.rb