EvoBal/test/test_helper.rb

31 lines
812 B
Ruby
Raw Normal View History

2020-10-17 12:16:28 +02:00
ENV['RAILS_ENV'] ||= 'test'
require_relative '../config/environment'
require 'rails/test_help'
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
2020-12-31 15:32:57 +01:00
def email_from_eml(file_fixture_name)
eml = file_fixture(file_fixture_name).read
mail = Mail.from_source(eml)
email_importer = EmailImporter.new
email_importer.import(mail)
end
2021-01-23 18:09:55 +01:00
def email_from_eml_with_rules(file_fixture_name)
email = email_from_eml(file_fixture_name)
RulesEvaluator.new.evaluate(email)
end
2020-12-31 15:32:57 +01:00
def assert_no_html(text)
assert_no_match(/<\/?(p|b|br|img)\/?>/, text)
end
2020-10-17 12:16:28 +02:00
end