test/test_api.rb in rest-graph-1.8.0 vs test/test_api.rb in rest-graph-1.9.0
- old
+ new
@@ -45,10 +45,22 @@
to_return(:body => '{"data": []}')
RestGraph.new.request({:headers => {'X-Forwarded-For' => '127.0.0.1'}},
[:get, 'http://example.com']).
should == {'data' => []}
+
+ EM.run{
+ RestGraph.new.request({:headers => {'X-Forwarded-For' => '127.0.0.1',
+ 'User-Agent' => 'Ruby',
+ 'Accept-Encoding' =>
+ 'gzip, deflate'},
+ :async => true},
+ [:get, 'http://example.com']){ |result|
+ result.should == {'data' => []}
+ EM.stop
+ }
+ }
end
should 'post right' do
stub_request(:post, 'https://graph.facebook.com/feed/me').
with(:body => 'message=hi%20there').to_return(:body => 'ok')
@@ -81,10 +93,10 @@
should 'call post_request after request' do
url = 'https://graph.facebook.com/feed/me'
stub_request(:put, url).
with(:body => 'message=hi%20there').to_return(:body => '[]')
- mock.proxy(rg = RestGraph.new).post_request('[]', url, {})
+ mock.proxy(rg = RestGraph.new).post_request({}, url, '[]')
rg.put('feed/me', :message => 'hi there').
should == []
end
should 'not raise exception when encountering error' do