lib/stub_requests/callback.rb in stub_requests-0.1.4 vs lib/stub_requests/callback.rb in stub_requests-0.1.5

- old
+ new

@@ -45,11 +45,18 @@ self.endpoint_id = endpoint_id self.verb = verb self.callback = callback end - def call(*args) - callback.call(*args) + def call(request_stub) + case arity + when 0 + callback.call + when 1 + callback.call(request_stub) + else + raise InvalidCallback, "The callback for a callback can either take 0 or 1 arguments (was #{arity})" + end end def arity callback.arity end