<commit_before><commit_msg>reorganize default permission specs for site and sections<commit_after>require File.dirname(__FILE__) + '/../spec_helper'

describe 'Models #default_permissions' do
  before :each do 
    @default_permissions = {
      :site    => { :theme    => { :show => :admin, :update => :admin, :create => :admin, :destroy => :admin }, 
                    :user     => { :show => :admin, :update => :admin, :create => :admin, :destroy => :admin }, 
                    :section  => { :show => :admin, :update => :admin, :create => :admin, :destroy => :admin }, 
                    :site     => { :show => :admin, :update => :admin, :create => :superuser, :destroy => :superuser, :manage => :admin } },

      :section => { :article  => { :update => :moderator, :create => :moderator, :destroy => :moderator, :show => :moderator }, 
                    :category => { :update => :moderator, :create => :moderator, :destroy => :moderator, :show => :moderator } },

      :blog    => { :category => { :update => :moderator, :create => :moderator, :destroy => :moderator, :show => :moderator },
                    :article  => { :show => :anonymous, :update => :user, :create => :user, :destroy => :user }, 
                    :comment  => { :update => :author, :destroy => :author, :create => :user } },

      :forum   => { :comment  => { :update => :author, :destroy => :author, :create => :user }, 
                    :topic    => { :moderate => :moderator, :update => :user, :destroy => :moderator, :create => :user } },

      :wiki    => { :category => { :update => :moderator, :create => :moderator, :destroy => :moderator, :show => :moderator },
                    :comment  => { :update => :author, :destroy => :author, :create => :user }, 
                    :wikipage => { :show => :anonymous, :update => :user, :create => :user, :destroy => :user}}
    }
  end

  it 'should return proper permissions for Site' do
    Site.default_permissions.to_hash.should == @default_permissions[:site]
  end

  it 'should return proper permissions for Section' do
    Section.default_permissions.to_hash.should == @default_permissions[:section]
  end

  it 'should return proper permissions for Blog' do
    Blog.default_permissions.to_hash.should == @default_permissions[:blog]
  end

  it 'should return proper permissions for Forum' do
    Forum.default_permissions.to_hash.should == @default_permissions[:forum]
  end

  it 'should return proper permissions for Wiki' do
    Wiki.default_permissions.to_hash.should == @default_permissions[:wiki]
  end
end
{'fraction_non_alphanumeric': 0.17183863460046547, 'fraction_numerical': 0.0, 'mean_word_length': 2.9615975422427034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 76, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5914510', 'n_tokens_mistral': 786, 'n_tokens_neox': 753, 'n_words': 202}