EvoBal/test/test_helper.rb

32 lines
885 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
2021-01-27 13:44:49 +01:00
parallelize(workers: :number_of_processors)
2020-10-17 12:16:28 +02:00
# 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
2021-01-24 17:49:35 +01:00
email = email_importer.import(mail)
2020-12-31 15:32:57 +01:00
2021-01-24 17:49:35 +01:00
email
2020-12-31 15:32:57 +01:00
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)
2021-01-25 14:32:26 +01:00
processor = RuleSetProcessor.new
email = processor.process_all(RuleSet.enabled, email)
2021-01-23 18:09:55 +01:00
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