2014-05-03 05:56:42 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe FbGraph2 do
|
|
|
|
subject { FbGraph2 }
|
|
|
|
after { FbGraph2.debugging = false }
|
|
|
|
|
2014-05-05 10:24:17 -04:00
|
|
|
context 'as default' do
|
|
|
|
its(:logger) { should be_a Logger }
|
|
|
|
its(:api_version) { should == 'v2.0' }
|
|
|
|
its(:root_url) { should == 'https://graph.facebook.com/v2.0' }
|
2014-06-05 05:29:48 -04:00
|
|
|
its(:object_classes) { should contain_exactly *FbGraph2::Node.subclasses }
|
2014-05-05 10:24:17 -04:00
|
|
|
it { should_not be_debugging }
|
|
|
|
end
|
2014-05-03 05:56:42 -04:00
|
|
|
|
|
|
|
describe '.debug!' do
|
|
|
|
before { FbGraph2.debug! }
|
2014-05-05 10:24:17 -04:00
|
|
|
it { should be_debugging }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.api_version' do
|
|
|
|
before { FbGraph2.api_version = 'v2.x' }
|
|
|
|
its(:root_url) { should == 'https://graph.facebook.com/v2.x' }
|
2014-05-03 05:56:42 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '.http_client' do
|
|
|
|
context 'with http_config' do
|
|
|
|
before do
|
|
|
|
FbGraph2.http_config do |config|
|
|
|
|
config.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
|
|
config.connect_timeout = 30
|
|
|
|
config.send_timeout = 40
|
|
|
|
config.receive_timeout = 60
|
|
|
|
end
|
|
|
|
end
|
2014-05-05 10:24:17 -04:00
|
|
|
|
2014-05-03 05:56:42 -04:00
|
|
|
it 'should configure Rack::OAuth2 and FbGraph2 http_client' do
|
|
|
|
[Rack::OAuth2, FbGraph2].each do |klass|
|
|
|
|
klass.http_client.ssl_config.verify_mode.should == OpenSSL::SSL::VERIFY_NONE
|
|
|
|
klass.http_client.connect_timeout.should == 30
|
|
|
|
klass.http_client.send_timeout.should == 40
|
|
|
|
klass.http_client.receive_timeout.should == 60
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|