Sha256: ef67fb5714269b2b78074ba189239225a101b13c0309b4a6c5f9e5a6a5196f98

Contents?: true

Size: 1.81 KB

Versions: 4

Compression:

Stored size: 1.81 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', :params => {
      :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', :params => {
      :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', :params => {
      :access_token => 'access_token',
      :limit => '25',
      :since => '2010-04-27T13:06:14+0000'
    } 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', :params => {
      :access_token => 'access_token',
      :limit => '25',
      :until => '2010-04-27T11:07:48+0000'
    } 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

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-1.7.5 spec/fb_graph/connection_spec.rb
fb_graph-1.7.4 spec/fb_graph/connection_spec.rb
fb_graph-1.7.3 spec/fb_graph/connection_spec.rb
fb_graph-1.7.2 spec/fb_graph/connection_spec.rb