Sha256: 7c01a346b71f969da885c41e6fb3e4ce6f36d3536e3dd50b85dfb7bab52c2b7a

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 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

    before :each do
      @api = Koala::Facebook::RestAPI.new(@token)
    end

    it_should_behave_like "Koala RestAPI"
    it_should_behave_like "Koala RestAPI with an access token"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
koala-1.0.0.beta2.1 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-1.0.0.beta2 spec/koala/rest_api/rest_api_with_access_token_tests.rb
koala-1.0.0.beta spec/koala/rest_api/rest_api_with_access_token_tests.rb