diff --git a/app/services/ssl.rb b/app/services/ssl.rb index 8d0d72c..19a916a 100644 --- a/app/services/ssl.rb +++ b/app/services/ssl.rb @@ -10,8 +10,8 @@ module SSL class Error < StandardError; end - class SSLCommandError < Error; end - class SSLConfigurationError < Error; end + class CommandError < Error; end + class ConfigurationError < Error; end class ParserError < Error; end class DomainNotMatchError < ParserError; end @@ -51,7 +51,7 @@ module SSL result = command.execute unless result.exit_status.zero? - fail SSLCommandError, "SSL command failed with status #{result.exit_status}" + fail SSL::CommandError, "SSL command failed with status #{result.exit_status}" end result @@ -79,7 +79,7 @@ module SSL def custom_check_http_args return nil unless configuration.check_http_args.present? - fail SSLConfigurationError, "check_http_args option must be an array of argument." \ + fail SSL::ConfigurationError, "check_http_args option must be an array of argument." \ unless configuration.check_http_args.is_a?(Array) configuration.check_http_args diff --git a/app/services/whois.rb b/app/services/whois.rb index 9b25b40..7c56234 100644 --- a/app/services/whois.rb +++ b/app/services/whois.rb @@ -11,7 +11,7 @@ module Whois class Error < StandardError; end - class WhoisCommandError < Error; end + class CommandError < Error; end class UnsupportedDomainError < Error; end class DomainNotFoundError < Error; end class ParserError < Error; end @@ -49,7 +49,7 @@ module Whois result = command.execute unless result.exit_status.zero? - fail WhoisCommandError, "Whois command failed with status #{result.exit_status}" + fail Whois::CommandError, "Whois command failed with status #{result.exit_status}" end result diff --git a/config/environment.rb b/config/environment.rb index 2c69703..426333b 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,7 +3,3 @@ 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/test/services/notifier/resolver_test.rb b/test/services/notifier/resolver_test.rb index 80d09b2..20335d2 100644 --- a/test/services/notifier/resolver_test.rb +++ b/test/services/notifier/resolver_test.rb @@ -2,6 +2,7 @@ # License: GNU AGPL-3+ (see full text in LICENSE file) require "test_helper" +# require "notifier/resolver" # rubocop:disable Metrics/LineLength module Notifier diff --git a/test/services/ssl_test.rb b/test/services/ssl_test.rb index 7965f0a..aafa2b3 100644 --- a/test/services/ssl_test.rb +++ b/test/services/ssl_test.rb @@ -11,7 +11,7 @@ module SSL result = OpenStruct.new(exit_status: 0) mock_system_klass("check_http", standard_args, result) do |system_klass| - service = Service.new("example.org", system_klass: system_klass) + service = SSL::Service.new("example.org", system_klass: system_klass) assert_equal result, service.run_command end end @@ -20,9 +20,9 @@ module SSL result = OpenStruct.new(exit_status: 1) mock_system_klass("check_http", standard_args, result) do |system_klass| - service = Service.new("example.org", system_klass: system_klass) + service = SSL::Service.new("example.org", system_klass: system_klass) - assert_raises SSLCommandError do + assert_raises SSL::CommandError do service.run_command end end @@ -34,7 +34,7 @@ module SSL stdout: file_fixture("ssl/ssl0.domain.org.txt").read, ) - service = Service.new("ssl0.domain.org") + service = SSL::Service.new("ssl0.domain.org") assert_kind_of SSL::Response, service.parse(result) end @@ -44,7 +44,7 @@ module SSL expected_args = standard_args.concat ["-f", "-I 127.0.0.1"] mock_system_klass("check_http", expected_args, result) do |system_klass| - service = Service.new("example.org", configuration: config, system_klass: system_klass) + service = SSL::Service.new("example.org", configuration: config, system_klass: system_klass) assert_equal result, service.run_command end end @@ -53,8 +53,8 @@ module SSL black_hole = Naught.build(&:black_hole) config = OpenStruct.new(check_http_args: "-f") - assert_raises SSLConfigurationError do - service = Service.new("example.org", configuration: config, system_klass: black_hole) + assert_raises SSL::ConfigurationError do + service = SSL::Service.new("example.org", configuration: config, system_klass: black_hole) service.run_command end end @@ -64,7 +64,7 @@ module SSL config = OpenStruct.new(check_http_path: "/usr/local/custom/path") mock_system_klass("/usr/local/custom/path", standard_args, result) do |sys| - service = Service.new("example.org", configuration: config, system_klass: sys) + service = SSL::Service.new("example.org", configuration: config, system_klass: sys) assert_equal result, service.run_command end end diff --git a/test/services/whois_test.rb b/test/services/whois_test.rb index d4c3bbb..afa22cd 100644 --- a/test/services/whois_test.rb +++ b/test/services/whois_test.rb @@ -11,7 +11,7 @@ module Whois result = OpenStruct.new(exit_status: 0) mock_system_klass("whois", "example.org", result) do |system_klass| - service = Service.new("example.org", system_klass: system_klass) + service = Whois::Service.new("example.org", system_klass: system_klass) assert_equal result, service.run_command end end @@ -20,9 +20,9 @@ module Whois result = OpenStruct.new(exit_status: 1) mock_system_klass("whois", "example.org", result) do |system_klass| - service = Service.new("example.org", system_klass: system_klass) + service = Whois::Service.new("example.org", system_klass: system_klass) - assert_raises WhoisCommandError do + assert_raises Whois::CommandError do service.run_command end end @@ -34,7 +34,7 @@ module Whois stdout: file_fixture("whois/domain.fr.txt").read, ) - service = Service.new("domain.fr") + service = Whois::Service.new("domain.fr") assert_kind_of Whois::Response, service.parse(result) end diff --git a/test/system/checks_test.rb b/test/system/checks_test.rb index b3c67a5..4546c45 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 c1c203e..eb4336c 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