test/test_handler.rb in rest-graph-1.4.5 vs test/test_handler.rb in rest-graph-1.4.6
- old
+ new
@@ -3,12 +3,10 @@
require_relative 'common'
else
require File.dirname(__FILE__) + '/common'
end
-require 'json'
-
describe RestGraph do
after do
reset_webmock
RR.verify
end
@@ -32,11 +30,11 @@
describe 'with Graph API' do
before do
@id = lambda{ |obj| obj }
@error = '{"error":{"type":"Exception","message":"(#2500)"}}'
- @error_hash = JSON.parse(@error)
+ @error_hash = RestGraph.json_decode(@error)
stub_request(:get, 'https://graph.facebook.com/me').
to_return(:body => @error)
end
@@ -61,10 +59,10 @@
# {"key":"query","value":
# "SELECT name FROM bad_table WHERE uid=12345"}]}
before do
@id = lambda{ |obj| obj }
@fql_error = '{"error_code":603,"error_msg":"Unknown table: bad"}'
- @fql_error_hash = JSON.parse(@fql_error)
+ @fql_error_hash = RestGraph.json_decode(@fql_error)
@bad_fql_query = 'SELECT name FROM bad_table WHERE uid="12345"'
bad_fql_request = "https://api.facebook.com/method/fql.query?" \
"format=json&query=#{CGI.escape(@bad_fql_query)}"