Sha256: d368127cc5fa324af8625edb26669dd112a430e641af47ba6ff01583882c65b6

Contents?: true

Size: 1.72 KB

Versions: 87

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'

describe FbGraph::Connection, '.new' do
  it 'should return an array with connection info' do
    mock_graph :get, 'platform/statuses', 'pages/statuses/platform_private', :access_token => 'access_token' do
      page = FbGraph::Page.new('platform', :access_token => 'access_token')
      statuses = page.statuses
      statuses.should be_kind_of(Array)
      statuses.collection.should be_kind_of(FbGraph::Collection)
      statuses.owner.should == page
      statuses.connection.should == :statuses
    end
  end
end

describe FbGraph::Connection do
  it 'should be useful for pagenation' do
    me = FbGraph::User.new('me', :access_token => 'access_token')
    posts = nil
    mock_graph :get, 'me/home', 'users/home/me_private', :access_token => 'access_token' do
      posts = me.home
      posts.first.created_time.should == Time.parse('2010-04-27T13:06:14+0000')
      posts.last.created_time.should  == Time.parse('2010-04-27T11:07:48+0000')
    end
    mock_graph :get, 'me/home', 'users/home/me_private_previous', :access_token => 'access_token', :params => {
      :limit => '25',
      :since => '123456789'
    } do
      previous_posts = posts.previous
      previous_posts.first.created_time.should == Time.parse('2010-04-27T13:23:08+0000')
      previous_posts.last.created_time.should  == Time.parse('2010-04-27T13:10:56+0000')
    end
    mock_graph :get, 'me/home', 'users/home/me_private_next', :access_token => 'access_token', :params => {
      :limit => '25',
      :until => '123456789'
    } do
      next_posts = posts.next
      next_posts.first.created_time.should == Time.parse('2010-04-27T11:06:29+0000')
      next_posts.last.created_time.should  == Time.parse('2010-04-27T09:44:28+0000')
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
fb_graph-2.7.0 spec/fb_graph/connection_spec.rb
fb_graph-2.6.7 spec/fb_graph/connection_spec.rb
fb_graph-2.6.6 spec/fb_graph/connection_spec.rb
fb_graph-2.6.5 spec/fb_graph/connection_spec.rb
fb_graph-2.6.4 spec/fb_graph/connection_spec.rb
fb_graph-2.6.3 spec/fb_graph/connection_spec.rb
fb_graph-2.6.2 spec/fb_graph/connection_spec.rb
fb_graph-2.6.1 spec/fb_graph/connection_spec.rb
fb_graph-2.6.0 spec/fb_graph/connection_spec.rb
fb_graph-2.5.9 spec/fb_graph/connection_spec.rb
fb_graph-2.5.8 spec/fb_graph/connection_spec.rb
fb_graph-2.5.7 spec/fb_graph/connection_spec.rb
fb_graph-2.5.6 spec/fb_graph/connection_spec.rb
fb_graph-2.5.5 spec/fb_graph/connection_spec.rb
fb_graph-2.5.4 spec/fb_graph/connection_spec.rb
fb_graph-2.5.3 spec/fb_graph/connection_spec.rb
fb_graph-2.5.2 spec/fb_graph/connection_spec.rb
fb_graph-2.5.1 spec/fb_graph/connection_spec.rb
fb_graph-2.5.0 spec/fb_graph/connection_spec.rb
fb_graph-2.4.20 spec/fb_graph/connection_spec.rb