Sha256: 801de1e415c8ab165dc6ecb438f43286266bbca99603771cf16c89f6f1bf2de2

Contents?: true

Size: 1.25 KB

Versions: 12

Compression:

Stored size: 1.25 KB

Contents

shared_examples_for "Koala RestAPI with an access token" do
  # FQL
  it "should be able to access public information via FQL" do
    result = @api.fql_query('select first_name from user where uid = 216743')
    result.size.should == 1
    result.first['first_name'].should == 'Chris'
  end

  it "should be able to access protected information via FQL" do
    # Tests agains the permissions fql table
    
    # get the current user's ID
    # we're sneakily using the Graph API, which should be okay since it has its own tests
    g = Koala::Facebook::GraphAPI.new(@token)
    id = g.get_object("me", :fields => "id")["id"]

    # now send a query about your permissions
    result = @api.fql_query("select read_stream from permissions where uid = #{id}")

    result.size.should == 1
    # we assume that you have read_stream permissions, so we can test against that
    # (should we keep this?)
    result.first["read_stream"].should == 1
  end
end

class FacebookRestAPIWithAccessTokenTests < Test::Unit::TestCase
  describe "Koala RestAPI with an access token" do
    it_should_behave_like "live testing examples"
    it_should_behave_like "Koala RestAPI with an access token"
    
    before :each do
      @api = Koala::Facebook::RestAPI.new(@token)
    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
koala-0.9.0 spec/koala/rest_api/rest_api_with_access_token_tests.rb
palidanx-koala-0.9.0 spec/koala/rest_api/rest_api_with_access_token_tests.rb
cotweet_koala-0.8.0.1 spec/koala/rest_api/rest_api_with_access_token_tests.rb
joelind-koala-0.8.4 spec/koala/rest_api/rest_api_with_access_token_tests.rb
joelind-koala-0.8.3 spec/koala/rest_api/rest_api_with_access_token_tests.rb
joelind-koala-0.8.1 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.8.0 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.7.4 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.7.3 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.7.2 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.7.1 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.7.0 spec/koala/rest_api/rest_api_with_access_token_tests.rb