<commit_before>require_relative '../../test_helper'
class EmailvalidatorTest < ActiveSupport::TestCase
  setup do
    class PersonWithEmail
      include MongoMapper::Document
      key :email_address, String
      validates :email_address,
                :email => true
    end
    @person = PersonWithEmail.new(:email_address => '<EMAIL>')
  end

  test 'is valid' do
    assert @person.valid?
  end

  test 'has error with invalid email' do
    @person.email_address = 'invalid@invalid'
    refute @person.valid?, 'should not be valid'
    assert_equal I18n.t(:'mongo_mapper.errors.messages.invalid_email'), @person.errors[:email_address].first
  end

end<commit_msg>Added some more invalid eddresses to test<commit_after>require_relative '../../test_helper'
class EmailvalidatorTest < ActiveSupport::TestCase
  setup do
    class PersonWithEmail
      include MongoMapper::Document
      key :email_address, String
      validates :email_address,
                :email => true
    end
    @person = PersonWithEmail.new(:email_address => '<EMAIL>')
  end

  test 'is valid' do
    assert @person.valid?
  end

  test 'has error with invalid email' do
    ['invalid', 'invalid<EMAIL>', 'invalid.com', 'invalid @<EMAIL>', '<EMAIL>'].each do |invalid_email_address|
      @person.email_address = 'invalid@invalid'
      refute @person.valid?, "should not be valid for: #{invalid_email_address}"
      assert_equal I18n.t(:'mongo_mapper.errors.messages.invalid_email'), @person.errors[:email_address].first
    end
  end

end
{'fraction_non_alphanumeric': 0.11205766710353866, 'fraction_numerical': 0.002621231979030144, 'mean_word_length': 3.6554878048780486, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '3391098', 'n_tokens_mistral': 456, 'n_tokens_neox': 450, 'n_words': 116}