From 73be45d5ef61f85cfcd878c4681240197d50dca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Sun, 3 Mar 2019 10:42:19 +0100 Subject: [PATCH] Remove a lot of useless "require" thanks to Zeitwerk --- app/jobs/ssl_sync_job.rb | 2 ++ app/jobs/whois_sync_job.rb | 2 ++ app/services/notifier.rb | 2 +- {lib => app/services}/null_logger.rb | 2 +- app/services/ssl.rb | 20 ++++++++++++++----- app/services/ssl/errors.rb | 14 ------------- app/services/ssl/parser.rb | 4 ++-- app/services/system_command.rb | 11 ++++++----- app/services/whois.rb | 22 +++++++++++++++------ app/services/whois/errors.rb | 14 ------------- app/services/whois/parser.rb | 18 ++++++++--------- app/services/whois/parser/afilias.rb | 6 +++--- app/services/whois/parser/afnic.rb | 6 +++--- app/services/whois/parser/base.rb | 6 +++--- app/services/whois/parser/cira.rb | 6 +++--- app/services/whois/parser/entry/blank.rb | 2 +- app/services/whois/parser/entry/field.rb | 2 +- app/services/whois/parser/entry/text.rb | 2 +- app/services/whois/parser/entry_builder.rb | 6 +++--- app/services/whois/parser/io.rb | 6 +++--- app/services/whois/parser/neustar.rb | 6 +++--- app/services/whois/parser/sonic.rb | 6 +++--- app/services/whois/parser/verisign.rb | 6 +++--- config/environment.rb | 4 ++++ config/initializers/inflections.rb | 3 +++ lib/errors.rb | 4 ---- lib/tasks/checks.rake | 2 +- package.json | 2 +- test/helpers/domain_helper_test.rb | 2 +- test/services/check_logger_test.rb | 8 ++++---- test/services/ssl/parser_test.rb | 4 ++-- test/services/ssl_test.rb | 2 +- test/services/system_command_test.rb | 4 ++-- test/services/whois/parser/afilias_test.rb | 6 +++--- test/services/whois/parser/afnic_test.rb | 6 +++--- test/services/whois/parser/cira_test.rb | 6 +++--- test/services/whois/parser/io_test.rb | 6 +++--- test/services/whois/parser/neustar_test.rb | 6 +++--- test/services/whois/parser/sonic_test.rb | 6 +++--- test/services/whois/parser/verisign_test.rb | 6 +++--- test/services/whois/parser_test.rb | 4 ++-- test/services/whois_test.rb | 4 ++-- test/system/checks_test.rb | 2 +- test/system/users_test.rb | 2 +- test/test_helper.rb | 6 +++--- test/test_mocks_helper.rb | 4 ++-- 46 files changed, 135 insertions(+), 135 deletions(-) rename {lib => app/services}/null_logger.rb (89%) delete mode 100644 app/services/ssl/errors.rb delete mode 100644 app/services/whois/errors.rb delete mode 100644 lib/errors.rb diff --git a/app/jobs/ssl_sync_job.rb b/app/jobs/ssl_sync_job.rb index 6c47679..6027278 100644 --- a/app/jobs/ssl_sync_job.rb +++ b/app/jobs/ssl_sync_job.rb @@ -1,3 +1,5 @@ +# require "ssl/errors" + class SSLSyncJob < ApplicationJob queue_as :default diff --git a/app/jobs/whois_sync_job.rb b/app/jobs/whois_sync_job.rb index 1532245..2902907 100644 --- a/app/jobs/whois_sync_job.rb +++ b/app/jobs/whois_sync_job.rb @@ -1,3 +1,5 @@ +# require "whois/errors" + class WhoisSyncJob < ApplicationJob queue_as :default diff --git a/app/services/notifier.rb b/app/services/notifier.rb index 4a59233..23400e7 100644 --- a/app/services/notifier.rb +++ b/app/services/notifier.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "notifier/processor" +# require "notifier/processor" module Notifier class << self diff --git a/lib/null_logger.rb b/app/services/null_logger.rb similarity index 89% rename from lib/null_logger.rb rename to app/services/null_logger.rb index 03352cf..ff68cea 100644 --- a/lib/null_logger.rb +++ b/app/services/null_logger.rb @@ -1,6 +1,6 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "naught" +# require "naught" NullLogger = Naught.build diff --git a/app/services/ssl.rb b/app/services/ssl.rb index e566352..8d0d72c 100644 --- a/app/services/ssl.rb +++ b/app/services/ssl.rb @@ -1,13 +1,23 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" -require "system_command" -require_relative "ssl/parser" -require_relative "ssl/response" -require_relative "ssl/errors" +# require "null_logger" +# require "system_command" +# require_relative "ssl/parser" +# require_relative "ssl/response" +# require_relative "ssl/errors" module SSL + class Error < StandardError; end + + class SSLCommandError < Error; end + class SSLConfigurationError < Error; end + + class ParserError < Error; end + class DomainNotMatchError < ParserError; end + class InvalidResponseError < ParserError; end + class InvalidDateError < ParserError; end + class << self def ask(domain, system_klass: SystemCommand, logger: NullLogger.new) Service.new(domain, system_klass: system_klass, logger: logger).call diff --git a/app/services/ssl/errors.rb b/app/services/ssl/errors.rb deleted file mode 100644 index aa15760..0000000 --- a/app/services/ssl/errors.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2018 Colin Darie , 2018 Evolix -# License: GNU AGPL-3+ (see full text in LICENSE file) - -module SSL - class Error < StandardError; end - - class SSLCommandError < Error; end - class SSLConfigurationError < Error; end - - class ParserError < Error; end - class DomainNotMatchError < ParserError; end - class InvalidResponseError < ParserError; end - class InvalidDateError < ParserError; end -end diff --git a/app/services/ssl/parser.rb b/app/services/ssl/parser.rb index 81caf76..deb04ee 100644 --- a/app/services/ssl/parser.rb +++ b/app/services/ssl/parser.rb @@ -1,8 +1,8 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" -require "ssl/errors" +# require "null_logger" +# require "ssl/errors" module SSL class Parser diff --git a/app/services/system_command.rb b/app/services/system_command.rb index 52dfdc9..3ad7e6e 100644 --- a/app/services/system_command.rb +++ b/app/services/system_command.rb @@ -1,12 +1,13 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "open4" -require "null_logger" - -SystemCommandResult = Struct.new(:command, :exit_status, :stdout, :stderr) +# require "open4" +# require "null_logger" class SystemCommand + Result = Struct.new(:command, :exit_status, :stdout, :stderr) + class NotAllowedError < StandardError; end + attr_reader :program attr_reader :args attr_reader :logger @@ -42,7 +43,7 @@ class SystemCommand pid, _, stdout, stderr = Open4.popen4 cmd _, status = Process.waitpid2 pid - SystemCommandResult.new( + Result.new( syscmd, status.exitstatus || 255, stdout.read.strip, diff --git a/app/services/whois.rb b/app/services/whois.rb index f6c0765..9b25b40 100644 --- a/app/services/whois.rb +++ b/app/services/whois.rb @@ -1,14 +1,24 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" -require "domain_helper" -require "system_command" -require_relative "whois/parser" -require_relative "whois/response" -require_relative "whois/errors" +# require "null_logger" +# require "domain_helper" +# require "system_command" +# require_relative "whois/parser" +# require_relative "whois/response" +# require_relative "whois/errors" module Whois + class Error < StandardError; end + + class WhoisCommandError < Error; end + class UnsupportedDomainError < Error; end + class DomainNotFoundError < Error; end + class ParserError < Error; end + + class FieldNotFoundError < ParserError; end + class InvalidDateError < ParserError; end + class << self def ask(domain, system_klass: SystemCommand, logger: NullLogger.new) Service.new(domain, system_klass: system_klass, logger: logger).call diff --git a/app/services/whois/errors.rb b/app/services/whois/errors.rb deleted file mode 100644 index 6348a98..0000000 --- a/app/services/whois/errors.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2018 Colin Darie , 2018 Evolix -# License: GNU AGPL-3+ (see full text in LICENSE file) - -module Whois - class Error < StandardError; end - - class WhoisCommandError < Error; end - class UnsupportedDomainError < Error; end - class DomainNotFoundError < Error; end - class ParserError < Error; end - - class FieldNotFoundError < ParserError; end - class InvalidDateError < ParserError; end -end diff --git a/app/services/whois/parser.rb b/app/services/whois/parser.rb index 9eec072..9663d7d 100644 --- a/app/services/whois/parser.rb +++ b/app/services/whois/parser.rb @@ -1,15 +1,15 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" -require "whois/errors" -require "whois/parser/afilias" -require "whois/parser/afnic" -require "whois/parser/cira" -require "whois/parser/io" -require "whois/parser/neustar" -require "whois/parser/sonic" -require "whois/parser/verisign" +# require "null_logger" +# require "whois/errors" +# require "whois/parser/afilias" +# require "whois/parser/afnic" +# require "whois/parser/cira" +# require "whois/parser/io" +# require "whois/parser/neustar" +# require "whois/parser/sonic" +# require "whois/parser/verisign" module Whois module Parser diff --git a/app/services/whois/parser/afilias.rb b/app/services/whois/parser/afilias.rb index d858083..8721bbc 100644 --- a/app/services/whois/parser/afilias.rb +++ b/app/services/whois/parser/afilias.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/afnic.rb b/app/services/whois/parser/afnic.rb index 342fd2a..02880df 100644 --- a/app/services/whois/parser/afnic.rb +++ b/app/services/whois/parser/afnic.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/base.rb b/app/services/whois/parser/base.rb index e327c11..c435e04 100644 --- a/app/services/whois/parser/base.rb +++ b/app/services/whois/parser/base.rb @@ -1,10 +1,10 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" +# require "null_logger" require_relative "../response" -require_relative "../errors" -require_relative "entry_builder" +# require_relative "../errors" +# require_relative "entry_builder" module Whois module Parser diff --git a/app/services/whois/parser/cira.rb b/app/services/whois/parser/cira.rb index cb248f2..3d8dcfb 100644 --- a/app/services/whois/parser/cira.rb +++ b/app/services/whois/parser/cira.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/entry/blank.rb b/app/services/whois/parser/entry/blank.rb index 4c34f8b..eebac1c 100644 --- a/app/services/whois/parser/entry/blank.rb +++ b/app/services/whois/parser/entry/blank.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require_relative "base" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/entry/field.rb b/app/services/whois/parser/entry/field.rb index 53ed379..dec73bf 100644 --- a/app/services/whois/parser/entry/field.rb +++ b/app/services/whois/parser/entry/field.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require_relative "base" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/entry/text.rb b/app/services/whois/parser/entry/text.rb index dc8c79c..15c1680 100644 --- a/app/services/whois/parser/entry/text.rb +++ b/app/services/whois/parser/entry/text.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require_relative "base" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/entry_builder.rb b/app/services/whois/parser/entry_builder.rb index 7b488d4..eefba09 100644 --- a/app/services/whois/parser/entry_builder.rb +++ b/app/services/whois/parser/entry_builder.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require_relative "entry/blank" -require_relative "entry/field" -require_relative "entry/text" +# require_relative "entry/blank" +# require_relative "entry/field" +# require_relative "entry/text" module Whois module Parser diff --git a/app/services/whois/parser/io.rb b/app/services/whois/parser/io.rb index c1f7648..3f12068 100644 --- a/app/services/whois/parser/io.rb +++ b/app/services/whois/parser/io.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/neustar.rb b/app/services/whois/parser/neustar.rb index 1406a55..b535f65 100644 --- a/app/services/whois/parser/neustar.rb +++ b/app/services/whois/parser/neustar.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/sonic.rb b/app/services/whois/parser/sonic.rb index ac5c683..b0b1c80 100644 --- a/app/services/whois/parser/sonic.rb +++ b/app/services/whois/parser/sonic.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/app/services/whois/parser/verisign.rb b/app/services/whois/parser/verisign.rb index a6ec93a..2b3019f 100644 --- a/app/services/whois/parser/verisign.rb +++ b/app/services/whois/parser/verisign.rb @@ -1,9 +1,9 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "domain_helper" -require "whois/errors" -require_relative "base" +# require "domain_helper" +# require "whois/errors" +# require_relative "base" module Whois module Parser diff --git a/config/environment.rb b/config/environment.rb index 426333b..2c69703 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,3 +3,7 @@ require_relative 'application' # Initialize the Rails application. Rails.application.initialize! +# binding.pry + +# Rails.autoloaders.main +# loader.push_dir(Rails.root.join("app/services")) diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index af698fc..e04aba3 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -13,4 +13,7 @@ # These inflection rules are supported but not enabled by default: ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'SSL' + inflect.acronym 'AFNIC' + inflect.acronym 'CIRA' + inflect.acronym 'IO' end diff --git a/lib/errors.rb b/lib/errors.rb deleted file mode 100644 index 6ab303e..0000000 --- a/lib/errors.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (C) 2018 Colin Darie , 2018 Evolix -# License: GNU AGPL-3+ (see full text in LICENSE file) - -class SystemCommandNotAllowedError < StandardError; end diff --git a/lib/tasks/checks.rake b/lib/tasks/checks.rake index 4f0975c..ce7a0d4 100644 --- a/lib/tasks/checks.rake +++ b/lib/tasks/checks.rake @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "null_logger" +# require "null_logger" namespace :checks do namespace :sync_dates do diff --git a/package.json b/package.json index 935295d..ec8b41e 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,12 @@ "name": "chexpire", "private": true, "dependencies": { + "@rails/ujs": "^6.0.0-alpha", "@rails/webpacker": "3.5", "bootstrap": "^4.1.1", "exports-loader": "^0.7.0", "jquery": "^3.3.1", "popper.js": "^1.14.3", - "@rails/ujs": "^6.0.0-alpha", "turbolinks": "^5.2.0" }, "devDependencies": { diff --git a/test/helpers/domain_helper_test.rb b/test/helpers/domain_helper_test.rb index b887943..857c3cf 100644 --- a/test/helpers/domain_helper_test.rb +++ b/test/helpers/domain_helper_test.rb @@ -2,7 +2,7 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "domain_helper" +# require "domain_helper" class DomainHelperTest < ActiveSupport::TestCase include DomainHelper diff --git a/test/services/check_logger_test.rb b/test/services/check_logger_test.rb index be0113c..83ff0a4 100644 --- a/test/services/check_logger_test.rb +++ b/test/services/check_logger_test.rb @@ -3,7 +3,7 @@ require "test_helper" require "check_logger" -require "system_command" +# require "system_command" class CheckLoggerTest < ActiveSupport::TestCase setup do @@ -20,7 +20,7 @@ class CheckLoggerTest < ActiveSupport::TestCase end test "should log a success raw result command" do - result = SystemCommandResult.new("command", 0, "the result", "") + result = SystemCommand::Result.new("command", 0, "the result", "") assert_no_difference -> { CheckLog.where(check: @check).count } do @logger.log :after_command, result @@ -33,7 +33,7 @@ class CheckLoggerTest < ActiveSupport::TestCase end test "should log a raw result command with an error" do - result = SystemCommandResult.new("command", 1, "optional stdout", "an error occured") + result = SystemCommand::Result.new("command", 1, "optional stdout", "an error occured") @logger.log :after_command, result assert_equal "optional stdout", @logger.check_log.raw_response @@ -43,7 +43,7 @@ class CheckLoggerTest < ActiveSupport::TestCase end test "should log an error when there is not exit status" do - result = SystemCommandResult.new("command", nil, nil, "an error") + result = SystemCommand::Result.new("command", nil, nil, "an error") @logger.log :after_command, result assert_nil @logger.check_log.raw_response diff --git a/test/services/ssl/parser_test.rb b/test/services/ssl/parser_test.rb index a4351e5..31fb3d0 100644 --- a/test/services/ssl/parser_test.rb +++ b/test/services/ssl/parser_test.rb @@ -2,8 +2,8 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "ssl/parser" -require "ssl/errors" +# require "ssl/parser" +# require "ssl/errors" module SSL class ParserTest < ActiveSupport::TestCase diff --git a/test/services/ssl_test.rb b/test/services/ssl_test.rb index 22ab321..fc38acd 100644 --- a/test/services/ssl_test.rb +++ b/test/services/ssl_test.rb @@ -3,7 +3,7 @@ require "test_helper" require "ssl" -require "system_command" +# require "system_command" module SSL class ServiceTest < ActiveSupport::TestCase diff --git a/test/services/system_command_test.rb b/test/services/system_command_test.rb index 169ada6..9b0265c 100644 --- a/test/services/system_command_test.rb +++ b/test/services/system_command_test.rb @@ -2,14 +2,14 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "system_command" +# require "system_command" class SystemCommandTest < ActiveSupport::TestCase test "should execute and log a command" do mock_logger = Minitest::Mock.new expected_cmd = 'whois "example.org"' - expected_result = SystemCommandResult.new( + expected_result = SystemCommand::Result.new( expected_cmd, 0, "my result", diff --git a/test/services/whois/parser/afilias_test.rb b/test/services/whois/parser/afilias_test.rb index e5e4b9a..ec6201a 100644 --- a/test/services/whois/parser/afilias_test.rb +++ b/test/services/whois/parser/afilias_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/afilias" -require "whois/response" -require "whois/errors" +# require "whois/parser/afilias" +# require "whois/response" +# require "whois/errors" module Whois class AfiliasTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/afnic_test.rb b/test/services/whois/parser/afnic_test.rb index 02629cc..682c71e 100644 --- a/test/services/whois/parser/afnic_test.rb +++ b/test/services/whois/parser/afnic_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/afnic" -require "whois/response" -require "whois/errors" +# require "whois/parser/afnic" +# require "whois/response" +# require "whois/errors" module Whois class AFNICTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/cira_test.rb b/test/services/whois/parser/cira_test.rb index 7dc42e9..59ad8ce 100644 --- a/test/services/whois/parser/cira_test.rb +++ b/test/services/whois/parser/cira_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/cira" -require "whois/response" -require "whois/errors" +# require "whois/parser/cira" +# require "whois/response" +# require "whois/errors" module Whois class CIRATest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/io_test.rb b/test/services/whois/parser/io_test.rb index 05973a8..50a5d04 100644 --- a/test/services/whois/parser/io_test.rb +++ b/test/services/whois/parser/io_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/io" -require "whois/response" -require "whois/errors" +# require "whois/parser/io" +# require "whois/response" +# require "whois/errors" module Whois class IOTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/neustar_test.rb b/test/services/whois/parser/neustar_test.rb index 2024198..d98c1b9 100644 --- a/test/services/whois/parser/neustar_test.rb +++ b/test/services/whois/parser/neustar_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/neustar" -require "whois/response" -require "whois/errors" +# require "whois/parser/neustar" +# require "whois/response" +# require "whois/errors" module Whois class NeustarTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/sonic_test.rb b/test/services/whois/parser/sonic_test.rb index b3087ee..b28e4a8 100644 --- a/test/services/whois/parser/sonic_test.rb +++ b/test/services/whois/parser/sonic_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/sonic" -require "whois/response" -require "whois/errors" +# require "whois/parser/sonic" +# require "whois/response" +# require "whois/errors" module Whois class SonicTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser/verisign_test.rb b/test/services/whois/parser/verisign_test.rb index 9e1d149..59221cc 100644 --- a/test/services/whois/parser/verisign_test.rb +++ b/test/services/whois/parser/verisign_test.rb @@ -2,9 +2,9 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser/verisign" -require "whois/response" -require "whois/errors" +# require "whois/parser/verisign" +# require "whois/response" +# require "whois/errors" module Whois class VerisignTest < ActiveSupport::TestCase diff --git a/test/services/whois/parser_test.rb b/test/services/whois/parser_test.rb index 9ec2f3b..b68a44d 100644 --- a/test/services/whois/parser_test.rb +++ b/test/services/whois/parser_test.rb @@ -2,8 +2,8 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois/parser" -require "whois/errors" +# require "whois/parser" +# require "whois/errors" module Whois class ParserTest < ActiveSupport::TestCase diff --git a/test/services/whois_test.rb b/test/services/whois_test.rb index 6b5d451..d52bbb0 100644 --- a/test/services/whois_test.rb +++ b/test/services/whois_test.rb @@ -2,8 +2,8 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" -require "whois" -require "system_command" +# require "whois" +# require "system_command" module Whois class ServiceTest < ActiveSupport::TestCase diff --git a/test/system/checks_test.rb b/test/system/checks_test.rb index 4546c45..b3c67a5 100644 --- a/test/system/checks_test.rb +++ b/test/system/checks_test.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Jeremy Lecour , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "application_system_test_case" +# require "application_system_test_case" class ChecksTest < ApplicationSystemTestCase setup do diff --git a/test/system/users_test.rb b/test/system/users_test.rb index eb4336c..c1c203e 100644 --- a/test/system/users_test.rb +++ b/test/system/users_test.rb @@ -1,7 +1,7 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "application_system_test_case" +# require "application_system_test_case" class UsersTest < ApplicationSystemTestCase setup do diff --git a/test/test_helper.rb b/test/test_helper.rb index ee2f342..ad53fa2 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -48,11 +48,11 @@ Capybara.javascript_driver = :headless_chrome Capybara.default_driver = :headless_chrome # Disable Open4 real system calls -require "open4" -require "errors" +# require "open4" +# require "errors" module Open4 def popen4(*) - fail SystemCommandNotAllowedError, + fail SystemCommand::NotAllowedError, "Real Open4 calls are disabled in test env. Use mock_system_command helper instead." end alias open4 popen4 diff --git a/test/test_mocks_helper.rb b/test/test_mocks_helper.rb index 3857095..c91ab94 100644 --- a/test/test_mocks_helper.rb +++ b/test/test_mocks_helper.rb @@ -1,13 +1,13 @@ # Copyright (C) 2018 Colin Darie , 2018 Evolix # License: GNU AGPL-3+ (see full text in LICENSE file) -require "system_command" +# require "system_command" module TestMocksHelper # rubocop:disable Metrics/MethodLength def mock_system_command(program, args, exit_status: 0, stdout: "", stderr: "") syscmd = "#{program} #{Array.wrap(args).join(' ')}" - result = SystemCommandResult.new(syscmd, exit_status, stdout, stderr) + result = SystemCommand::Result.new(syscmd, exit_status, stdout, stderr) mock = Minitest::Mock.new mock.expect :execute, result