diff --git a/Gemfile b/Gemfile index 7bedc3bb..d3de2b6e 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gemspec gem 'oauth2' gem 'typhoeus' +gem 'warning' gem 'zeitwerk' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 382a1fa2..d7f6fde9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -167,6 +167,7 @@ GEM unicode-display_width (2.6.0) uri (1.0.3) version_gem (1.1.7) + warning (1.5.0) zeitwerk (2.6.18) PLATFORMS @@ -190,6 +191,7 @@ DEPENDENCIES steep testcontainers typhoeus + warning zeitwerk zitadel-client! diff --git a/lib/patch.rb b/lib/patch.rb index da72025f..e1b40cc3 100644 --- a/lib/patch.rb +++ b/lib/patch.rb @@ -2,10 +2,11 @@ module OAuth2 module Strategy - # noinspection RbsMissingTypeSignature - class Assertion < Base + # rubocop:disable Style/Documentation + module AssertionPatch private + # noinspection RbsMissingTypeSignature def build_assertion(claims, opts) raise ArgumentError, 'encoding_opts must include :algorithm and :key' unless opts.is_a?(Hash) && opts.key?(:algorithm) && opts.key?(:key) @@ -14,5 +15,10 @@ def build_assertion(claims, opts) JWT.encode(claims, opts[:key], opts[:algorithm], headers) end end + # rubocop:enable Style/Documentation + + class Assertion < Base + prepend AssertionPatch + end end end diff --git a/lib/zitadel_client.rb b/lib/zitadel_client.rb index 531bf9a0..85793f35 100644 --- a/lib/zitadel_client.rb +++ b/lib/zitadel_client.rb @@ -2,8 +2,11 @@ require 'zeitwerk' require 'oauth2' +require 'warning' require_relative 'patch' +Warning.ignore(:method_redefined, __dir__) + # Main entrypoint for the ZitadelClient Ruby SDK. # # This module encapsulates all functionality for authenticating with and accessing diff --git a/sig/lib/warning/warning.rbs b/sig/lib/warning/warning.rbs new file mode 100644 index 00000000..2ee46119 --- /dev/null +++ b/sig/lib/warning/warning.rbs @@ -0,0 +1,3 @@ +module Warning + def self.ignore: (Regexp | Symbol | Array[Symbol], String?) -> void +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6f1d2d9b..9995b7b4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,11 +17,17 @@ # Override the HTMLFormatter so that it writes its report inside build/coverage/html module SimpleCov module Formatter - class HTMLFormatter + # rubocop:disable Style/Documentation + module HTMLFormatterPatch def output_path File.join(SimpleCov.coverage_path, 'html') end end + # rubocop:enable Style/Documentation + + class HTMLFormatter + prepend HTMLFormatterPatch + end end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 6f1d2d9b..49ea3d1b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'warning' require 'dotenv' require 'simplecov' require 'simplecov-lcov' @@ -17,11 +18,17 @@ # Override the HTMLFormatter so that it writes its report inside build/coverage/html module SimpleCov module Formatter - class HTMLFormatter + # rubocop:disable Style/Documentation + module HTMLFormatterPatch def output_path File.join(SimpleCov.coverage_path, 'html') end end + # rubocop:enable Style/Documentation + + class HTMLFormatter + prepend HTMLFormatterPatch + end end end