Sha256: a9d2249339457c74ed9719136c61918595d04a1d7721570973d3d61712c18ebd
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
if respond_to?(:require_relative, true) require_relative 'common' else require File.dirname(__FILE__) + '/common' end describe RestGraph do before do @rg = RestGraph.new(:app_id => '29', :secret => '18') @uri = 'http://zzz.tw' end after do WebMock.reset! end should 'return correct oauth url' do TestHelper.normalize_url(@rg.authorize_url(:redirect_uri => @uri)). should == 'https://graph.facebook.com/oauth/authorize?' \ 'client_id=29&redirect_uri=http%3A%2F%2Fzzz.tw' end should 'do authorizing and parse result and save it in data' do stub_request(:post, 'https://graph.facebook.com/oauth/access_token'). \ with(:body => {'client_id' => '29' , 'client_secret' => '18' , 'redirect_uri' => 'http://zzz.tw', 'code' => 'zzz'}). to_return(:body => 'access_token=baken&expires=2918') result = {'access_token' => 'baken', 'expires' => '2918'} @rg.authorize!(:redirect_uri => @uri, :code => 'zzz'). should == result @rg.data.should == result end should 'not append access_token in authorize_url even presented' do RestGraph.new(:access_token => 'do not use me').authorize_url. should == 'https://graph.facebook.com/oauth/authorize' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest-graph-2.0.3 | test/test_oauth.rb |
rest-graph-2.0.2 | test/test_oauth.rb |
rest-graph-2.0.1 | test/test_oauth.rb |