Sha256: c59561cd2ab2975dabefc10afec6cd86a5779990f26a443c189b315491cb17e9

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

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

class AdminsRoleGroupPermit < CanTango::RoleGroupPermit
  def initialize ability
    super
  end

  protected

  def static_rules
  end
end

describe CanTango::PermitEngine::Factory do
  
  before do
    CanTango.config.cache.set :off
  end

  let (:user) do
    User.new 'kris'
  end

  let (:user_account) do
    ua = UserAccount.new user, :role_groups => [:admins]
    user.account = ua
  end

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

  let (:factory) do
    CanTango::PermitEngine::Factory.new ability
  end

  describe 'attributes' do
    it "should have an ability" do
      factory.ability.should be_a(CanTango::Ability)
    end
  end

  describe '#build!' do
    it 'should build a list of permits' do
      factory.build!.should_not be_empty
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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