lib/minitest/keyword.rb in minitest-keyword-0.0.2 vs lib/minitest/keyword.rb in minitest-keyword-1.0.0
- old
+ new
@@ -1,15 +1,19 @@
+# frozen_string_literal: true
+
require 'minitest'
require 'minitest/keyword/version'
module Minitest
# The module containing overridden assertion methods that will be prepended
# into the Test class
module Keyword
# Longer names so that the keywords make more sense
ALIASES = {
+ a: :expected,
act: :actual,
+ b: :actual,
cls: :class,
exp: :expected,
meth: :method,
msg: :message,
obj: :object,
@@ -36,10 +40,11 @@
Assertions.instance_methods.grep(/assert|refute/).each do |method_name|
parameters = Assertions.instance_method(method_name).parameters
next if parameters.empty?
+ # rubocop:disable Metrics/MethodLength
define_method(method_name) do |*args, **kwargs, &block|
passed_params = []
parameters.each.with_index do |(type, arg_name), index|
if args.length > index &&
@@ -63,9 +68,10 @@
end
super(*passed_params, &block)
end
end
+ # rubocop:enable Metrics/MethodLength
end
# Hook into the Minitest::Test class and prepend the Keyword module
class Test
prepend Keyword