Sha256: 73781b10a005a884c7d2cfa8dc5a5a04203d125f02ba5ad9129f507ca374ae6e

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require File.join(File.dirname(__FILE__), '../spec_helper')

describe FbGraph::Collection, '#new' do
  before(:all) do
    fake_json(:get, 'platform/statuses?token=token', 'pages/statuses/platform_private')
  end

  it 'should return an array with pagination info' do
    statuses = FbGraph::Page.new('platform', :token => 'token').statuses
    statuses.should be_kind_of(Array)
    statuses.previous.should be_kind_of(Hash)
    statuses.next.should be_kind_of(Hash)
  end
end

describe FbGraph::Collection do
  before(:all) do
    fake_json(:get, 'me/home?token=token', 'users/home/me_private')
    fake_json(:get, 'me/home?limit=25&since=2010-04-27T13%3A06%3A14%2B0000&token=token', 'users/home/me_private_previous')
    fake_json(:get, 'me/home?limit=25&token=token&until=2010-04-27T11%3A07%3A48%2B0000', 'users/home/me_private_next')
  end

  it 'should ' do
    me = FbGraph::User.new('me', :token => 'token')
    posts = me.home
    puts posts.previous.inspect, posts.next.inspect
    previous_posts = me.home(posts.previous)
    next_posts = me.home(posts.next)
    posts.first.created_time.should == '2010-04-27T13:06:14+0000'
    posts.last.created_time.should == '2010-04-27T11:07:48+0000'
    previous_posts.first.created_time.should == '2010-04-27T13:23:08+0000'
    previous_posts.last.created_time.should == '2010-04-27T13:10:56+0000'
    next_posts.first.created_time.should == '2010-04-27T11:06:29+0000'
    next_posts.last.created_time.should == '2010-04-27T09:44:28+0000'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-0.0.3 spec/fb_graph/collection_spec.rb