test/test_old.rb in rest-graph-1.6.0 vs test/test_old.rb in rest-graph-1.7.0
- old
+ new
@@ -5,11 +5,11 @@
require File.dirname(__FILE__) + '/common'
end
describe RestGraph do
after do
- WebMock.reset_webmock
+ WebMock.reset!
RR.verify
end
should 'do fql query with/without access_token' do
fql = 'SELECT name FROM likes where id="123"'
@@ -52,11 +52,11 @@
body = 'hate facebook inconsistent'
stub_request(:get,
'https://api.facebook.com/method/notes.create?format=json').
to_return(:body => body)
- RestGraph.new.old_rest('notes.create', {}, :suppress_decode => true).
+ RestGraph.new.old_rest('notes.create', {}, :auto_decode => false).
should == body
end
should 'exchange sessions for access token' do
stub_request(:post,
@@ -69,38 +69,16 @@
:secret => 'di').
exchange_sessions(:sessions => 'bad bed').
first['access_token'].should == 'bogus'
end
- should 'broken json' do
- stub_request(:get,
- 'https://api.facebook.com/method/admin.getAppProperties?' \
- 'access_token=123%7Cs&format=json&properties=app_id'
- ).to_return(:body => '"{\"app_id\":\"123\"}"')
-
- RestGraph.new(:app_id => '123', :secret => 's').
- secret_old_rest('admin.getAppProperties', :properties => 'app_id').
- should == {'app_id' => '123'}
- end
-
should 'use an secret access_token' do
stub_request(:get,
'https://api.facebook.com/method/admin.getAppProperties?' \
'access_token=123%7Cs&format=json&properties=app_id'
).to_return(:body => '{"app_id":"123"}')
RestGraph.new(:app_id => '123', :secret => 's').
secret_old_rest('admin.getAppProperties', :properties => 'app_id').
should == {'app_id' => '123'}
- end
-
- should 'not parse twice in strict mode' do
- stub_request(:get,
- 'https://api.facebook.com/method/admin.getAppProperties?' \
- 'access_token=123%7Cs&format=json&properties=app_id'
- ).to_return(:body => '"{\"app_id\":\"123\"}"')
-
- RestGraph.new(:app_id => '123', :secret => 's', :strict => true).
- secret_old_rest('admin.getAppProperties', :properties => 'app_id').
- should == '{"app_id":"123"}'
end
end