# File lib/faraday/adapter/test.rb, line 65 def delete(path, &block) new_stub(:delete, path, &block) end
# File lib/faraday/adapter/test.rb, line 27 def empty? @stack.empty? end
# File lib/faraday/adapter/test.rb, line 45 def get(path, &block) new_stub(:get, path, &block) end
# File lib/faraday/adapter/test.rb, line 49 def head(path, &block) new_stub(:head, path, &block) end
# File lib/faraday/adapter/test.rb, line 31 def match(request_method, path, body) return false if !@stack.key?(request_method) stack = @stack[request_method] consumed = (@consumed[request_method] ||= []) path = normalize_path(path) if stub = matches?(stack, path, body) consumed << stack.delete(stub) stub else matches?(consumed, path, body) end end
# File lib/faraday/adapter/test.rb, line 69 def options(path, &block) new_stub(:options, path, &block) end
# File lib/faraday/adapter/test.rb, line 61 def patch(path, body=nil, &block) new_stub(:patch, path, body, &block) end
# File lib/faraday/adapter/test.rb, line 53 def post(path, body=nil, &block) new_stub(:post, path, body, &block) end
# File lib/faraday/adapter/test.rb, line 57 def put(path, body=nil, &block) new_stub(:put, path, body, &block) end
Raises an error if any of the stubbed calls have not been made.
# File lib/faraday/adapter/test.rb, line 74 def verify_stubbed_calls failed_stubs = [] @stack.each do |method, stubs| unless stubs.size == 0 failed_stubs.concat(stubs.map {|stub| "Expected #{method} #{stub}." }) end end raise failed_stubs.join(" ") unless failed_stubs.size == 0 end
# File lib/faraday/adapter/test.rb, line 92 def matches?(stack, path, body) stack.detect { |stub| stub.matches?(path, body) } end
Generated with the Darkfish Rdoc Generator 2.