Sha256: 77fe226ca65f1a50dd4b10029849b5b7504c0a646008102ec4e9953c975b9c40

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 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
    include LiveTestingDataHelper
    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

2 entries across 2 versions & 1 rubygems

Version Path
koala-0.10.0 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-0.9.1 spec/koala/rest_api/rest_api_with_access_token_tests.rb