<commit_before>Given(/^I am signed in as (.*)$/) do |name|
  if name == "an instructor"
    @instructor = Fabricate(:instructor)
    visit new_instructor_session_path
    fill_in "Email", with: @instructor.email
    fill_in "Password", with: "password"
    click_button "Login"
  elsif name == "a student"
    @student = Fabricate.build(:student)
    sign_into_github_as(@student.github_username, @student.github_uid)
    visit '/students/auth/github'
  else
    @student = Student.where(name: name).first
    sign_into_github_as(@student.github_username, @student.github_uid)
    visit '/students/auth/github'
  end
end

Given(/^I am signed in to Github as "(.*?)"$/) do |username|
  sign_into_github_as(username)
end

def sign_into_github_as(username, uid = nil)
  uid ||= '12345'
  OmniAuth.config.add_mock(:github, {
    uid: uid,
    credentials: {
      token: "d141ef15f79ca4c6f43a8c688e0434648f277f20",
    },
    info: {
      nickname: username,<commit_msg>store student during testing<commit_after>Given(/^I am signed in as (.*)$/) do |name|
  if name == "an instructor"
    @instructor = Fabricate(:instructor)
    visit new_instructor_session_path
    fill_in "Email", with: @instructor.email
    fill_in "Password", with: "password"
    click_button "Login"
  elsif name == "a student"
    @student = Fabricate.build(:student)
    sign_into_github_as(@student.github_username, @student.github_uid)
    visit '/students/auth/github'
    @student = Student.last
  else
    @student = Student.where(name: name).first
    sign_into_github_as(@student.github_username, @student.github_uid)
    visit '/students/auth/github'
  end
end

Given(/^I am signed in to Github as "(.*?)"$/) do |username|
  sign_into_github_as(username)
end

def sign_into_github_as(username, uid = nil)
  uid ||= '12345'
  OmniAuth.config.add_mock(:github, {
    uid: uid,
    credentials: {
      token: "d141ef15f79ca4c6f43a8c688e0434648f277f20",
    },
    info: {
      nickname: username,
{'fraction_non_alphanumeric': 0.1279716742539201, 'fraction_numerical': 0.03237228123419322, 'mean_word_length': 3.969849246231156, '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': '7242744', 'n_tokens_mistral': 730, 'n_tokens_neox': 691, 'n_words': 146}