21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-03 01:10:50 +02:00
chexpire/test/test_helper.rb

59 lines
1.6 KiB
Ruby
Raw Normal View History

# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
2018-05-23 15:56:43 +02:00
ENV["RAILS_ENV"] ||= "test"
2018-06-02 15:44:34 +02:00
require "pry"
if !ENV["NO_COVERAGE"] && (ARGV.empty? || ARGV.include?("test/test_helper.rb"))
require "simplecov"
SimpleCov.start "rails" do
2018-06-04 14:06:37 +02:00
add_group "Notifier", "app/services/notifier"
add_group "Whois", "app/services/whois"
2018-07-02 17:21:08 +02:00
add_group "SSL", "app/services/ssl"
2018-06-02 15:44:34 +02:00
add_group "Services", "app/services"
add_group "Policies", "app/policies"
end
end
2018-05-23 15:56:43 +02:00
require_relative "../config/environment"
require "rails/test_help"
2018-05-23 10:32:04 +02:00
2018-05-29 22:32:25 +02:00
require "minitest/mock"
require_relative "test_mocks_helper"
2018-06-04 14:03:08 +02:00
require_relative "chexpire_assertions"
2018-05-29 22:32:25 +02:00
2018-05-23 10:32:04 +02:00
class ActiveSupport::TestCase
2019-03-03 23:42:17 +01:00
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
2018-05-23 10:32:04 +02:00
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Warden::Test::Helpers
Warden.test_mode!
2018-05-23 10:32:04 +02:00
# Add more helper methods to be used by all tests here...
include ActiveJob::TestHelper
2018-06-02 14:44:00 +02:00
include FactoryBot::Syntax::Methods
include TestMocksHelper
2018-06-04 14:03:08 +02:00
include ChexpireAssertions
2018-05-23 10:32:04 +02:00
end
# Disable Open4 real system calls
# require "open4"
# require "errors"
module Open4
def popen4(*)
fail SystemCommand::NotAllowedError,
"Real Open4 calls are disabled in test env. Use mock_system_command helper instead."
end
alias open4 popen4
alias pfork4 popen4
alias popen4ext popen4
module_function :open4
module_function :popen4
module_function :pfork4
module_function :popen4ext
end