<commit_before>require 'test_helper'

class UserStoriesTest < ActionDispatch::IntegrationTest
  test 'creating a new user ends at the new user\'s dashboard' do
    register_as 'tester', '<EMAIL>', 'password'
    assert_equal dashboard_path, current_path, 'New user was not directed to their dashboard after creating an account'
  end
  
  test 'logging in as an existing user goes to the users dashboard' do
    log_in_as_user
    
    assert_equal dashboard_path, current_path, 'Existing user was not directed to their dashboard after logging in'
  end
  
  test 'logging in anonymously goes into an empty dashboard' do
    log_in_as_anon
    
    assert_equal dashboard_path, current_path, 'Anonymous user was not directed to their dashboard after logging in'
  end
  
  ##
  # Regression test for bug #366
  
  test 'Anonymous flag is reset on user logins' do
    log_in_as_anon
    log_out
    log_in_as_user
    refute page.has_content?('You are currently using an anonymous account'), 'Logged-in user was told they were using an anonymous account, regression of #366'
  end
end<commit_msg>Add regression test for #378<commit_after>require 'test_helper'

class UserStoriesTest < ActionDispatch::IntegrationTest
  test 'creating a new user ends at the new user\'s dashboard' do
    register_as '<NAME>', '<EMAIL>', 'HiDad'
    assert_equal dashboard_path, current_path, 'New user was not directed to their dashboard after creating an account'
  end
  
  test 'logging in as an existing user goes to the users dashboard' do
    log_in_as_user
    
    assert_equal dashboard_path, current_path, 'Existing user was not directed to their dashboard after logging in'
  end
  
  test 'logging in anonymously goes into an empty dashboard' do
    log_in_as_anon
    
    assert_equal dashboard_path, current_path, 'Anonymous user was not directed to their dashboard after logging in'
  end
  
  # Regression test for https://github.com/drusepth/Indent/issues/366
  
  test 'Anonymous flag is reset on user logins' do
    log_in_as_anon
    log_out
    log_in_as_user
    refute page.has_content?('You are currently using an anonymous account'), 'Logged-in user was told they were using an anonymous account, regression of https://github.com/drusepth/Indent/issues/366'
  end
  
  # Regression test for https://github.com/drusepth/Indent/issues/378
  
  test 'user can log in to new accounts' do
    register_as '<NAME>', '<EMAIL>', 'HiDad'
    log_out
    log_in_as '<NAME>', 'HiDad'
    assert_equal dashboard_path, current_path, 'Users cannot log in to new accounts, regression of https://github.com/drusepth/Indent/issues/378'
  end
end
{'fraction_non_alphanumeric': 0.06449165402124431, 'fraction_numerical': 0.007966616084977238, 'mean_word_length': 3.947467166979362, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '1672961', 'n_tokens_mistral': 811, 'n_tokens_neox': 770, 'n_words': 302}