<commit_before>require 'test_helper'

#
# == MailingSettingTest Model
#
class MailingSettingTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end<commit_msg>Add tests for email validator<commit_after>require 'test_helper'

#
# == MailingSettingTest Model
#
class MailingSettingTest < ActiveSupport::TestCase
  test 'should save mailing setting if email is nil' do
    mailing_user = MailingSetting.new
    assert mailing_user.valid?
    assert mailing_user.errors.keys.empty?
  end

  test 'should save mailing setting if email is blank' do
    mailing_user = MailingSetting.new(email: '')
    assert mailing_user.valid?
    assert mailing_user.errors.keys.empty?
  end

  test 'should save mailing setting if email is correct' do
    mailing_user = MailingSetting.new(email: '<EMAIL>')
    assert mailing_user.valid?
    assert mailing_user.errors.keys.empty?
  end

  test 'should not save mailing setting if email is not correct' do
    mailing_user = MailingSetting.new(email: 'mailing')
    assert_not mailing_user.valid?
    assert_equal [:email], mailing_user.errors.keys
  end
end
{'fraction_non_alphanumeric': 0.08042895442359249, 'fraction_numerical': 0.0, 'mean_word_length': 4.258215962441315, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '6646109', 'n_tokens_mistral': 350, 'n_tokens_neox': 334, 'n_words': 99}