Sha256: 45facff502ce38193b1c77dd4445ae0388983f050e2f897dd79c5d43b261291e

Contents?: true

Size: 1.55 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
cantango-0.9.4.7 spec/cantango/permits/permit_spec.rb
cantango-0.9.4.6 spec/cantango/permits/permit_spec.rb
cantango-0.9.4.5 spec/cantango/permits/permit_spec.rb
cantango-0.9.4.3 spec/cantango/permits/permit_spec.rb
cantango-0.9.4.2 spec/cantango/permits/permit_spec.rb
cantango-0.9.4.1 spec/cantango/permits/permit_spec.rb
cantango-0.9.4 spec/cantango/permits/permit_spec.rb
cantango-0.9.3.2 spec/cantango/permits/permit_spec.rb