<commit_before>require 'test_helper'

describe CategoryPolicy do
  let(:category) { nil }

  describe 'as a visitor' do
    let(:user)  { nil }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as a user' do
    let(:user)  { FactoryGirl.build :user }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as a moderator' do
    let(:user)  { FactoryGirl.build :moderator }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as an admin' do
    let(:user)  { FactoryGirl.build :admin }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal true
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal true
    end
    it 'does no allow to upate' do
      subject.update?.must_equal true
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal true
    end
    it 'does no allow to create' do
      subject.create?.must_equal true
    end
    it 'does no allow to new' do
      subject.new?.must_equal true
    end
  end

end<commit_msg>rmed redundant whitespace [ci skip]<commit_after>require 'test_helper'

describe CategoryPolicy do
  let(:category) { nil }

  describe 'as a visitor' do
    let(:user)  { nil }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as a user' do
    let(:user)  { FactoryGirl.build :user }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as a moderator' do
    let(:user)  { FactoryGirl.build :moderator }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal false
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal false
    end
    it 'does no allow to upate' do
      subject.update?.must_equal false
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal false
    end
    it 'does no allow to create' do
      subject.create?.must_equal false
    end
    it 'does no allow to new' do
      subject.new?.must_equal false
    end
  end

  describe 'as an admin' do
    let(:user)  { FactoryGirl.build :admin }
    subject     { CategoryPolicy.new(user, category) }

    it 'does not allow to manage' do
      subject.manage?.must_equal true
    end
    it 'does not allow to edit' do
      subject.edit?.must_equal true
    end
    it 'does no allow to upate' do
      subject.update?.must_equal true
    end
    it 'does no allow to destroy' do
      subject.destroy?.must_equal true
    end
    it 'does no allow to create' do
      subject.create?.must_equal true
    end
    it 'does no allow to new' do
      subject.new?.must_equal true
    end
  end
end
{'fraction_non_alphanumeric': 0.07262247838616714, 'fraction_numerical': 0.0, 'mean_word_length': 2.315923566878981, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '351538', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1560, 'n_words': 593}