<commit_before>require 'application_system_test_case'

class ProfilesTest < ApplicationSystemTestCase
  def setup
    @superadmin = create :user_with_profile
    @noprofile = create :user
  end

  test 'when first login displays profile form' do
    visit new_user_session_path
    fill_in 'Email', with: @noprofile.email
    fill_in 'Password', with: '<PASSWORD>'
    click_on 'Log in'

    assert page.has_current_path? new_profile_path
    assert page.has_text? 'New profile'

    assert page.has_field? 'First name'
    assert page.has_field? 'Last name'
    assert page.has_field? 'Phone'
    assert page.has_field? 'Avatar'
    assert page.has_field? 'Address'
    assert page.has_field? 'Profession'
    assert page.has_field? 'Monday'
    assert page.has_field? 'Tuesday'
    assert page.has_field? 'Wednesday'
    assert page.has_field? 'Thursday'
    assert page.has_field? 'Friday'

    fill_in 'First name', with: 'Hans'
    fill_in 'Last name', with: 'Muster'
    click_on 'Create Profile'

    assert page.has_current_path? profile_path(@noprofile.profile.id)
    assert page.has_text? 'Hans'
    assert page.has_text? 'Muster'
    assert page.has_text? 'Profile was successfully created.'
  end

  test 'when profile created it can be displayed' do
    visit new_user_session_path
    fill_in 'Email', with: @noprofile.email
    fill_in 'Password', with: '<PASSWORD>'
    click_on 'Log in'

    fill_in 'First name', with: 'Hans'
    fill_in 'Last name', with: 'Muster'
    click_on 'Create Profile'

    click_on 'Toggle navigation' if page.has_button? 'Toggle navigation'

    assert page.has_link? @noprofile.email

    click_link @noprofile.email
    assert page.has_link? 'Show profile'

    click_on 'Show profile'

    assert page.has_text? 'My Profile'
    assert page.has_text? 'Information'
    assert page.has_text? @noprofile.profile.first_name
    assert page.has_text? @noprofile.profile.last_name<commit_msg>profiles test matches view changes<commit_after>require 'application_system_test_case'

class ProfilesTest < ApplicationSystemTestCase
  def setup
    @superadmin = create :user_with_profile
    @noprofile = create :user
  end

  test 'when first login displays profile form' do
    visit new_user_session_path
    fill_in 'Email', with: @noprofile.email
    fill_in 'Password', with: '<PASSWORD>'
    click_on 'Log in'

    assert page.has_current_path? new_profile_path
    assert page.has_text? 'New profile'

    assert page.has_field? 'First name'
    assert page.has_field? 'Last name'
    assert page.has_field? 'Phone'
    assert page.has_field? 'Avatar'
    assert page.has_field? 'Address'
    assert page.has_field? 'Profession'
    assert page.has_field? 'Monday'
    assert page.has_field? 'Tuesday'
    assert page.has_field? 'Wednesday'
    assert page.has_field? 'Thursday'
    assert page.has_field? 'Friday'

    fill_in 'First name', with: 'Hans'
    fill_in 'Last name', with: 'Muster'
    click_on 'Create Profile'

    assert page.has_current_path? profile_path(@noprofile.profile.id)
    assert page.has_text? 'Hans'
    assert page.has_text? 'Muster'
    assert page.has_text? 'Profile was successfully created.'
  end

  test 'when profile created it can be displayed' do
    visit new_user_session_path
    fill_in 'Email', with: @noprofile.email
    fill_in 'Password', with: '<PASSWORD>'
    click_on 'Log in'

    fill_in 'First name', with: 'Hans'
    fill_in 'Last name', with: 'Muster'
    click_on 'Create Profile'

    click_on 'Toggle navigation' if page.has_button? 'Toggle navigation'

    assert page.has_link? @noprofile.email

    click_link @noprofile.email
    assert page.has_link? 'Show profile'

    click_on 'Show profile'

    assert page.has_text? 'My Profile'
    assert page.has_text? @noprofile.profile.first_name
    assert page.has_text? @noprofile.profile.last_name
{'fraction_non_alphanumeric': 0.09333679025149079, 'fraction_numerical': 0.0, 'mean_word_length': 3.8285356695869837, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '4124550', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1237, 'n_words': 346}