lib/rest-graph/test_util.rb in rest-graph-1.8.0 vs lib/rest-graph/test_util.rb in rest-graph-1.9.0

- old
+ new

@@ -12,22 +12,28 @@ module_function def setup any_instance_of(RestGraph){ |rg| stub(rg).data{default_data} - stub(rg).fetch{ |meth, uri, payload| + stub(rg).fetch{ |opts, uri, meth, payload| history << [meth, uri, payload] http = 'https?://[\w\d]+(\.[\w\d]+)+/' response = case uri when %r{#{http}method/fql.multiquery} RestGraph.json_decode( Rack::Utils.parse_query( - URI.parse(uri).query)['queries']).keys.map{ |q| - {'name' => q, - 'fql_result_set' => [default_response]} - } - when %r{#{http}method/\w+\.\w+} - [default_response] + URI.parse(opts[:uri] || uri).query)['queries']). + keys.map{ |q| + {'name' => q, + 'fql_result_set' => [default_response]} + } + when %r{#{http}method/(\w+\.\w+)} + case $2 + when 'friends.getAppUsers' + [5678] + else + [default_response] + end else default_response end RestGraph.json_encode(response) }