Sha256: 450673437903f872af4d8e04af2745a786485d1ea231cab6209cb5eabe6cba0c

Contents?: true

Size: 1.55 KB

Versions: 13

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

module AdminAccountPermits
class AdminRolePermit < CanTango::RolePermit
end
end

class MusicianRolePermit < CanTango::RolePermit; end
class EditorsRoleGroupPermit < CanTango::RoleGroupPermit; end
class AdminAccountPermit < CanTango::AccountPermit; end
class AdminPermit < CanTango::UserPermit; end

describe CanTango::Permits::Permit do

  it "should register RolePermit-based permits" do
    CanTango.config.permits.admin_account.role[:admin].should == AdminAccountPermits::AdminRolePermit
    CanTango.config.permits.role[:musician].should == MusicianRolePermit
  end
  
  it "should register RoleGroupPermit-based permits" do
    CanTango.config.permits.role_group[:editors].should == EditorsRoleGroupPermit
  end
 
  it "should register UserPermit-based permits" do
    CanTango.config.permits.user[:admin].should == AdminPermit
  end
  it "should register AccountPermit-based permits" do
    CanTango.config.permits.account[:admin].should == AdminAccountPermit
  end

  context "registration of double-inherited permits (fx RolePermit ones) - specially for Kris ;)" do
    before do
      class GuitaristRolePermit < MusicianRolePermit; end
      class AdminAccountPermits::AngryAdminRolePermit < AdminAccountPermits::AdminRolePermit; end
    end

    it "should register basic namespaced" do
      CanTango.config.permits.role[:guitarist].should == GuitaristRolePermit
    end

    it "should register account-namespaced" do
      CanTango.config.permits.admin_account.role[:angry_admin].should == AdminAccountPermits::AngryAdminRolePermit
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cantango-0.8.9.5 spec/cantango/permits/permit_spec.rb
cantango-0.8.9.4 spec/cantango/permits/permit_spec.rb
cantango-0.8.9.3 spec/cantango/permits/permit_spec.rb
cantango-0.8.9.2 spec/cantango/permits/permit_spec.rb
cantango-0.8.9.1 spec/cantango/permits/permit_spec.rb
cantango-0.8.9 spec/cantango/permits/permit_spec.rb
cantango-0.8.8.1 spec/cantango/permits/permit_spec.rb
cantango-0.8.8 spec/cantango/permits/permit_spec.rb
cantango-0.8.7 spec/cantango/permits/permit_spec.rb
cantango-0.8.6.2 spec/cantango/permits/permit_spec.rb
cantango-0.8.6.1 spec/cantango/permits/permit_spec.rb
cantango-0.8.6 spec/cantango/permits/permit_spec.rb
cantango-0.8.5.1 spec/cantango/permits/permit_spec.rb