Sha256: 253108eafcb21ed3b665efb12cbbb16c975da70050aaf40dab35e83503628976

Contents?: true

Size: 1.06 KB

Versions: 27

Compression:

Stored size: 1.06 KB

Contents

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

describe FbGraph::Connections::Books, '#books' do
  context 'when included by FbGraph::User' do
    before(:all) do
      fake_json(:get, 'matake/books', 'users/books/matake_public')
      fake_json(:get, 'matake/books?access_token=access_token', 'users/books/matake_private')
    end

    context 'when no access_token given' do
      it 'should raise FbGraph::Unauthorized' do
        lambda do
          FbGraph::User.new('matake').books
        end.should raise_exception(FbGraph::Unauthorized)
      end
    end

    context 'when access_token is given' do
      it 'should return books as FbGraph::Page' do
        books = FbGraph::User.new('matake', :access_token => 'access_token').books
        books.first.should == FbGraph::Page.new(
          '102253616477130',
          :access_token => 'access_token',
          :name => 'Momo Michael Ende',
          :category => 'Unknown'
        )
        books.each do |book|
          book.should be_instance_of(FbGraph::Page)
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
fb_graph-1.1.6 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.5 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.4 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.3 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.2 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.1 spec/fb_graph/connections/books_spec.rb
fb_graph-1.1.0 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.7 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.6 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.5 spec/fb_graph/connections/books_spec.rb
palidanx-fb_graph-1.0.4 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.4 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.3 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.2 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.1 spec/fb_graph/connections/books_spec.rb
fb_graph-1.0.0 spec/fb_graph/connections/books_spec.rb
fb_graph-0.8.0 spec/fb_graph/connections/books_spec.rb
fb_graph-0.7.3 spec/fb_graph/connections/books_spec.rb
fb_graph-0.7.2 spec/fb_graph/connections/books_spec.rb
fb_graph-0.7.1 spec/fb_graph/connections/books_spec.rb