Sha256: f7a07b1bec90d54ffd1651db04347c6f21c4bd08b5fa0bfd2822a049346bc5d1

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

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

describe FbGraph::Connections::Home, '#home' do
  describe 'when included by FbGraph::User' do
    before(:all) do
      fake_json(:get, 'me/home', 'users/home/me_public')
      fake_json(:get, 'me/home?access_token=access_token', 'users/home/me_private')
      fake_json(:get, 'arjun/home', 'users/home/arjun_public')
      fake_json(:get, 'arjun/home?access_token=access_token', 'users/home/arjun_private')
    end

    it 'should raise FbGraph::Exception when no access_token given' do
      lambda do
        FbGraph::User.new('arjun').home
      end.should raise_exception(FbGraph::Exception)
    end

    it 'should raise FbGraph::Exception when identifier is not me' do
      lambda do
        FbGraph::User.new('arjun', :access_token => 'access_token').home
      end.should raise_exception(FbGraph::Exception)
    end

    it 'shoud raise FbGraph::NotFound when identifier is me and no access_token is given' do
      lambda do
        FbGraph::User.new('me').home
      end.should raise_exception(FbGraph::NotFound)
    end

    it 'shoud return posts when identifier is me and access_token is given' do
      posts = FbGraph::User.new('me', :access_token => 'access_token').home
      posts.each do |post|
        post.should be_instance_of(FbGraph::Post)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-0.0.1 spec/fb_graph/connections/home_spec.rb