<commit_before>require "test_helper"
include Warden::Test::Helpers

feature "CanUserMessage" do

  scenario "should message another user", js: true do

    @user1 = FactoryGirl.create(:user)
    @user2 = FactoryGirl.create(:user)

    login_as @user1

    visit message_new_path(@user2)
    body = "hola trololo"
    fill_in "mailboxer_message_subject", with: "hola mundo"
    fill_in "mailboxer_message_body", with: body
    click_button "Enviar"
    page.must_have_content body
    page.must_have_content "Mover mensaje a papelera"

    reply = "What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!"
    fill_in "mailboxer_message_body", with: reply
    click_button "Enviar"
    page.must_have_content reply
  end

end
<commit_msg>[tests] Extract a method to keep DRYer code<commit_after>require "test_helper"
include Warden::Test::Helpers

feature "CanUserMessage" do

  scenario "should message another user", js: true do

    @user1 = FactoryGirl.create(:user)
    @user2 = FactoryGirl.create(:user)

    login_as @user1

    visit message_new_path(@user2)

    send_message("hola trololo", "hola mundo")
    page.must_have_content body
    page.must_have_content "Mover mensaje a papelera"

    send_message("What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!What a nice emoji😀!")
    page.must_have_content reply
  end

  def send_message(body, subject = nil)
    fill_in("mailboxer_message_subject", with: subject) if subject
    fill_in "mailboxer_message_body", with: body
    click_button "Enviar"
  end
end

{'fraction_non_alphanumeric': 0.09125235997482693, 'fraction_numerical': 0.005034612964128383, 'mean_word_length': 4.353535353535354, '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': '1765304', 'n_tokens_mistral': 548, 'n_tokens_neox': 563, 'n_words': 148}