Sha256: 6a6fdc090b4858f797e03272b5ea09d3d9365b2482e273e919cf7b7fc19123b4

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Books, '#books' do
  context 'when included by FbGraph::User' do
    context 'when no access_token given' do
      it 'should raise FbGraph::Unauthorized' do
        mock_graph :get, 'matake/books', 'users/books/matake_public', :status => [401, 'Unauthorized'] do
          lambda do
            FbGraph::User.new('matake').books
          end.should raise_exception(FbGraph::Unauthorized)
        end
      end
    end

    context 'when access_token is given' do
      it 'should return books as FbGraph::Page' do
        mock_graph :get, 'matake/books', 'users/books/matake_private', :params => {
          :access_token => 'access_token'
        } 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
end

Version data entries

4 entries across 4 versions & 1 rubygems

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