<commit_before>require 'test_helper'

class VolunteerPolicyTest < PolicyAssertions::Test
  def setup
    @superadmin = create :user, role: 'superadmin'
    @social_worker = create :user, role: 'social_worker'
    @department_manager = create :user, role: 'department_manager'
  end

  test 'Create: only superadmin can create volunteer' do
    assert_permit @superadmin, Volunteer, 'new?', 'create?'
    refute_permit @social_worker, Volunteer, 'new?', 'create?'
    refute_permit @department_manager, Volunteer, 'new?', 'create?'
  end

  test 'Destroy: only superadmin can destroy' do
    assert_permit @superadmin, Volunteer, 'destroy?'
    refute_permit @social_worker, Volunteer, 'destroy?'
    refute_permit @department_manager, Volunteer, 'destroy?'
  end

  test 'Update: only superadmin can update and show all volunteers' do
    assert_permit @superadmin, Volunteer, 'update?', 'edit?', 'show?'
    refute_permit @social_worker, Volunteer, 'update?', 'edit?', 'show?'
    refute_permit @department_manager, Volunteer, 'update?', 'edit?', 'show?'
  end

  test 'Index: only a superadmin can index Volunteers' do
    assert_permit @superadmin, Volunteer, 'index?'
    refute_permit @department_manager, Volunteer, 'index?'
    refute_permit @social_worker, Volunteer, 'index?'
  end

  test 'Seeking clients: superadmin can see volunteers seeking clients' do
    assert_permit @superadmin, Volunteer, 'seeking_clients?'
  end

  test 'Seeking clients: social worker cannot see volunteers seeking clients' do
    refute_permit @social_worker, Volunteer, 'seeking_clients?'
  end

  test 'Seeking clients: department manager cannot see volunteers seeking clients' do
    refute_permit @department_manager, Volunteer, 'seeking_clients?'
  end
end
<commit_msg>volunteers checklist policy test<commit_after>require 'test_helper'

class VolunteerPolicyTest < PolicyAssertions::Test
  def setup
    @superadmin = create :user, role: 'superadmin'
    @social_worker = create :user, role: 'social_worker'
    @department_manager = create :user, role: 'department_manager'
  end

  test 'Create: only superadmin can create volunteer' do
    assert_permit @superadmin, Volunteer, 'new?', 'create?'
    refute_permit @social_worker, Volunteer, 'new?', 'create?'
    refute_permit @department_manager, Volunteer, 'new?', 'create?'
  end

  test 'Destroy: only superadmin can destroy' do
    assert_permit @superadmin, Volunteer, 'destroy?'
    refute_permit @social_worker, Volunteer, 'destroy?'
    refute_permit @department_manager, Volunteer, 'destroy?'
  end

  test 'Update: only superadmin can update and show all volunteers' do
    assert_permit @superadmin, Volunteer, 'update?', 'edit?', 'show?'
    refute_permit @social_worker, Volunteer, 'update?', 'edit?', 'show?'
    refute_permit @department_manager, Volunteer, 'update?', 'edit?', 'show?'
  end

  test 'Index: only a superadmin can index Volunteers' do
    assert_permit @superadmin, Volunteer, 'index?'
    refute_permit @department_manager, Volunteer, 'index?'
    refute_permit @social_worker, Volunteer, 'index?'
  end

  test 'Seeking clients: superadmin can see volunteers seeking clients' do
    assert_permit @superadmin, Volunteer, 'seeking_clients?'
  end

  test 'Seeking clients: social worker cannot see volunteers seeking clients' do
    refute_permit @social_worker, Volunteer, 'seeking_clients?'
  end

  test 'Seeking clients: department manager cannot see volunteers seeking clients' do
    refute_permit @department_manager, Volunteer, 'seeking_clients?'
  end

  test "Checklist: superadmin can see volunteer's checklist" do
    assert_permit @superadmin, Volunteer, 'checklist?'
  end

  test "Checklist: social worker can see volunteer's checklist" do
    refute_permit @social_worker, Volunteer, 'checklist?'
  end

  test "Checklist: department manager cannot see volunteer's checklist" do
    refute_permit @department_manager, Volunteer, 'checklist?'
  end
end

{'fraction_non_alphanumeric': 0.09670886075949367, 'fraction_numerical': 0.0, 'mean_word_length': 5.192789968652038, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4539961', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1184, 'n_words': 383}