lib/mocktail/share/stringifies_call.rb in mocktail-1.2.3 vs lib/mocktail/share/stringifies_call.rb in mocktail-2.0.0

- old
+ new

@@ -1,7 +1,9 @@ module Mocktail class StringifiesCall + extend T::Sig + def stringify(call, anonymous_blocks: false, always_parens: false) "#{call.method}#{args_to_s(call, parens: always_parens)}#{blockify(call.block, anonymous: anonymous_blocks)}" end def stringify_multiple(calls, nonzero_message:, zero_message:, @@ -29,19 +31,21 @@ if !args_lists.empty? "(#{args_lists.join(", ")})" elsif parens "()" + else + "" end end def argify(args) - return unless args && !args.empty? + return unless !args.empty? args.map(&:inspect).join(", ") end def kwargify(kwargs) - return unless kwargs && !kwargs.empty? + return unless !kwargs.empty? kwargs.map { |key, val| "#{key}: #{val.inspect}" }.join(", ") end def lambdafy(block) return unless block&.lambda?