lib/much-stub/call_spy.rb in much-stub-0.1.4 vs lib/much-stub/call_spy.rb in much-stub-0.1.5

- old
+ new

@@ -52,13 +52,11 @@ def call_spy_method_return_value(method_name, much_stub_call) @call_spy_method_return_values[method_name.to_s].call(much_stub_call) end def call_spy_return_value_proc(method_name) - value = @call_spy_return_values[method_name] - return value if value.respond_to?(:call) - - ::Proc.new { value.nil? ? self : value } + value = @call_spy_return_values.fetch(method_name, ::Proc.new { self }) + value.respond_to?(:call) ? value : ::Proc.new { value } end def call_spy_normalize_method_name(name) METHOD_NAME_REPLACEMENTS.reduce(name.to_s) { |acc, (source, replacement)| acc.gsub(source, replacement)