<commit_before>require "test_helper"

class PeopleControllerTest < ActionController::TestCase
  include Devise::TestHelpers

  def test_edit
    get :edit, id: people(:one).id
    assert_redirected_to new_user_session_path

    sign_in users(:one)
    session[:current_applicant_id] = 1
    get :edit, id: people(:one).id
    assert_response :success
  end

  def test_update
    sign_in users(:one)
    session[:current_applicant_id] = 1
    person_update_hash = {
      first_name: "x",
      last_name: "x",
      middle_name: "x",
      dob: "2000-01-01",
      gender: "x",
      ssn: "x",
      work_phone: "x",
      home_phone: "x",
      cell_phone: "x",
      citizenship: "x",
      nationality: "x",
      email: "x",
      race: "x",
      student_status: "x",
      marital_status: "x",
      occupation: "x",
      state_of_birth: "x",
      city_of_birth: "x",
      driver_license_number: "x",
      driver_license_state: "x",
    }
    put :update, id: people(:one).id, person: person_update_hash

    assert_attributes_were_updated people(:one), person_update_hash.keys

    assert_redirected_to applicants(:one)
  end

  def test_destroy
    sign_in users(:one)
    session[:current_applicant_id] = 1
    assert_difference('Person.count', -1) do
      delete :destroy, id: people(:one)
    end

    assert_redirected_to applicant_path(applicants(:one))
  end

end<commit_msg>Fix person redirect test<commit_after>require "test_helper"

class PeopleControllerTest < ActionController::TestCase
  include Devise::TestHelpers

  def test_edit
    get :edit, id: people(:one).id
    assert_redirected_to new_user_session_path

    sign_in users(:one)
    session[:current_applicant_id] = 1
    get :edit, id: people(:one).id
    assert_response :success
  end

  def test_update
    sign_in users(:one)
    session[:current_applicant_id] = 1
    person_update_hash = {
      first_name: "x",
      last_name: "x",
      middle_name: "x",
      dob: "2000-01-01",
      gender: "x",
      ssn: "x",
      work_phone: "x",
      home_phone: "x",
      cell_phone: "x",
      citizenship: "x",
      nationality: "x",
      email: "x",
      race: "x",
      student_status: "x",
      marital_status: "x",
      occupation: "x",
      state_of_birth: "x",
      city_of_birth: "x",
      driver_license_number: "x",
      driver_license_state: "x",
    }
    put :update, id: people(:one).id, person: person_update_hash

    assert_attributes_were_updated people(:one), person_update_hash.keys

    assert_redirected_to edit_person_path(people(:one))
  end

  def test_destroy
    sign_in users(:one)
    session[:current_applicant_id] = 1
    assert_difference('Person.count', -1) do
      delete :destroy, id: people(:one)
    end

    assert_redirected_to applicant_path(applicants(:one))
  end

end
{'fraction_non_alphanumeric': 0.11865008880994671, 'fraction_numerical': 0.00852575488454707, 'mean_word_length': 3.1411764705882352, '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': '6260272', 'n_tokens_mistral': 995, 'n_tokens_neox': 953, 'n_words': 208}