<commit_before>module RailsTestHelpers
  def create_user(options={})
    user = User.create!(
        username: 'usertest',
        email: options[:email] || "<EMAIL>",
        password: options[:password] || '<PASSWORD>',
        password_confirmation: options[:password] || '<PASSWORD>',
        created_at: Time.now.utc
    )
    user.primary_email_record.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at]
    user.confirm unless options[:confirm] == false
    user
  end

  def create_email(user, options = {})
    email_address = user.multi_email.format_email(options[:email] || "<EMAIL>")
    user.email = email_address

    email = user.emails.to_a.find { |record| record.email == email_address }
    email.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at]

    if options[:confirm] == false
      user.save
    else
      email.confirm
    end

    email
  end

  def sign_in_as_user(options={}, &block)
    user = create_user(options)
    visit_with_option options[:visit], new_user_session_path
    fill_in 'email', with: options[:email] || '<EMAIL>'
    fill_in 'password', with: options[:password] || '<PASSWORD>'
    check 'remember me' if options[:remember_me] == true
    yield if block_given?
    click_button 'Log In'
    user
  end<commit_msg>Change specs 'create_email' to not use confirmable#email=<commit_after>module RailsTestHelpers
  def create_user(options={})
    user = User.create!(
        username: 'usertest',
        email: options[:email] || "<EMAIL>",
        password: options[:password] || '<PASSWORD>',
        password_confirmation: options[:password] || '<PASSWORD>',
        created_at: Time.now.utc
    )
    user.primary_email_record.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at]
    user.confirm unless options[:confirm] == false
    user
  end

  def create_email(user, options = {})
    email_address = options[:email] || "<EMAIL>#{<EMAIL>"
    user.multi_email.find_or_build_for_email(email_address)

    email = user.emails.to_a.find { |record| record.email == email_address }
    email.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at]

    if options[:confirm] == false
      user.save
    else
      email.confirm
    end

    email
  end

  def sign_in_as_user(options={}, &block)
    user = create_user(options)
    visit_with_option options[:visit], new_user_session_path
    fill_in 'email', with: options[:email] || '<EMAIL>'
    fill_in 'password', with: options[:password] || '<PASSWORD>'
    check 'remember me' if options[:remember_me] == true
    yield if block_given?
    click_button 'Log In'
    user
  end
{'fraction_non_alphanumeric': 0.12513407222023595, 'fraction_numerical': 0.0, 'mean_word_length': 4.050541516245487, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '2066368', 'n_tokens_mistral': 868, 'n_tokens_neox': 858, 'n_words': 178}