<commit_before>require 'test_helper'

class SpaminatorPlugin::ReportTest < ActiveSupport::TestCase

  should 'must belong to an environment' do
    report = SpaminatorPlugin::Report.new
    report.valid?
    assert report.errors.include?(:environment)

    report.environment = Environment.default
    report.valid?
    refute report.errors.include?(:environment)
  end

  should 'have scope of all reports from an environment' do
    environment = Environment.default
    r1 = SpaminatorPlugin::Report.create(:environment => environment)
    r2 = SpaminatorPlugin::Report.create(:environment => environment)
    r3 = SpaminatorPlugin::Report.create(:environment => environment)
    r4 = SpaminatorPlugin::Report.create(:environment => fast_create(Environment))

    reports = SpaminatorPlugin::Report.from_environment(environment)

    assert_equal ActiveRecord::Relation, reports.class
    assert_includes reports, r1
    assert_includes reports, r2
    assert_includes reports, r3
    assert_not_includes reports, r4
  end

  should 'initialize failed hash' do
    report = SpaminatorPlugin::Report.new

    assert report.failed.kind_of?(Hash)
    assert report.failed.has_key?(:people)
    assert report.failed.has_key?(:comments)
    assert_equal [], report.failed[:people]
    assert_equal [], report.failed[:comments]
  end

end<commit_msg>spaminator: Remove unnecessary type assert (fix test)<commit_after>require 'test_helper'

class SpaminatorPlugin::ReportTest < ActiveSupport::TestCase

  should 'must belong to an environment' do
    report = SpaminatorPlugin::Report.new
    report.valid?
    assert report.errors.include?(:environment)

    report.environment = Environment.default
    report.valid?
    refute report.errors.include?(:environment)
  end

  should 'have scope of all reports from an environment' do
    environment = Environment.default
    r1 = SpaminatorPlugin::Report.create(:environment => environment)
    r2 = SpaminatorPlugin::Report.create(:environment => environment)
    r3 = SpaminatorPlugin::Report.create(:environment => environment)
    r4 = SpaminatorPlugin::Report.create(:environment => fast_create(Environment))

    reports = SpaminatorPlugin::Report.from_environment(environment)

    assert_includes reports, r1
    assert_includes reports, r2
    assert_includes reports, r3
    assert_not_includes reports, r4
  end

  should 'initialize failed hash' do
    report = SpaminatorPlugin::Report.new

    assert report.failed.kind_of?(Hash)
    assert report.failed.has_key?(:people)
    assert report.failed.has_key?(:comments)
    assert_equal [], report.failed[:people]
    assert_equal [], report.failed[:comments]
  end

end
{'fraction_non_alphanumeric': 0.09518477043673013, 'fraction_numerical': 0.0059723777528928705, 'mean_word_length': 4.665961945031713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4938554', 'n_tokens_mistral': 736, 'n_tokens_neox': 722, 'n_words': 170}