lib/strictly_fake.rb in strictly_fake-0.1.2 vs lib/strictly_fake.rb in strictly_fake-0.1.3

- old
+ new

@@ -51,11 +51,11 @@ end private def stub_method(meth, &block) - if respond_to?(meth) + if Object.respond_to?(meth) (class << self; self; end).class_eval do undef_method meth end end @@ -82,10 +82,11 @@ raise Error, "Expected #{real_class_name}#{method_type}#{meth} stub to "\ "accept (#{format_parametes(expected_parameters)}), but was (#{format_parametes(actual_parameters)})" end + # rubocop:disable Metrics/MethodLength def format_parametes(parameters) parameters.map do |(type, name)| { req: 'req', opt: 'opt=', @@ -95,9 +96,10 @@ keyrest: '**keyrest', block: '&block' }.fetch(type) end.join(', ') end + # rubocop:enable Metrics/MethodLength def method_signatures_match?(expected_parameters, actual_parameters) expected_keyword_parameters, expected_positional_parameters = split_parameters_by_type(expected_parameters) actual_keyword_parameters, actual_positional_parameters = split_parameters_by_type(actual_parameters)