Sha256: f4a8fb6be7acc6403636a7a08ba4e4097f3aed994a93621a1346156a3861160c

Contents?: true

Size: 1.59 KB

Versions: 11

Compression:

Stored size: 1.59 KB

Contents

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

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

  it 'should return an array with pagination info' do
    statuses = FbGraph::Page.new('platform', :access_token => 'access_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?access_token=access_token', 'users/home/me_private')
    fake_json(:get, 'me/home?limit=25&since=2010-04-27T13%3A06%3A14%2B0000&access_token=access_token', 'users/home/me_private_previous')
    fake_json(:get, 'me/home?limit=25&access_token=access_token&until=2010-04-27T11%3A07%3A48%2B0000', 'users/home/me_private_next')
  end

  it 'should be useful for pagenation' do
    me = FbGraph::User.new('me', :access_token => 'access_token')
    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')
    previous_posts = me.home(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')
    next_posts = me.home(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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fb_graph-0.4.2 spec/fb_graph/collection_spec.rb
fb_graph-0.4.1 spec/fb_graph/collection_spec.rb
fb_graph-0.4.0 spec/fb_graph/collection_spec.rb
fb_graph-0.3.0 spec/fb_graph/collection_spec.rb
fb_graph-0.2.2 spec/fb_graph/collection_spec.rb
fb_graph-0.2.1 spec/fb_graph/collection_spec.rb
fb_graph-0.2.0 spec/fb_graph/collection_spec.rb
fb_graph-0.1.3 spec/fb_graph/collection_spec.rb
fb_graph-0.1.2 spec/fb_graph/collection_spec.rb
fb_graph-0.1.1 spec/fb_graph/collection_spec.rb
fb_graph-0.1.0 spec/fb_graph/collection_spec.rb