lib/bogus/shadow.rb in bogus-0.0.4 vs lib/bogus/shadow.rb in bogus-0.1.0

- old
+ new

@@ -1,13 +1,13 @@ module Bogus class Shadow attr_reader :calls - def initialize(&default_return_value) + def initialize @calls = [] @stubs = [] - @defaults = Hash.new(default_return_value) + @defaults = {} @required = Set.new end def run(method_name, *args) interaction = Interaction.new(method_name, args) @@ -52,9 +52,10 @@ end def return_value(interaction) _, return_value = @stubs.reverse.find{|i, v| i == interaction} return_value ||= @defaults[interaction.method] + return_value ||= proc{ UndefinedReturnValue.new(interaction) } return_value.call end end end