Sha256: 6f8fabc726e765889e16ad29b65284e21a24de6e9e5d19339885824b12961a84

Contents?: true

Size: 1.09 KB

Versions: 104

Compression:

Stored size: 1.09 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', :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

104 entries across 104 versions & 1 rubygems

Version Path
fb_graph-2.1.2 spec/fb_graph/connections/books_spec.rb
fb_graph-2.1.1 spec/fb_graph/connections/books_spec.rb
fb_graph-2.1.0 spec/fb_graph/connections/books_spec.rb
fb_graph-2.1.0.alpha spec/fb_graph/connections/books_spec.rb
fb_graph-2.0.2 spec/fb_graph/connections/books_spec.rb
fb_graph-2.0.1 spec/fb_graph/connections/books_spec.rb
fb_graph-2.0.0 spec/fb_graph/connections/books_spec.rb
fb_graph-2.0.0.beta spec/fb_graph/connections/books_spec.rb
fb_graph-2.0.0.alpha spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.5 spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.4 spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.3 spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.2 spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.1 spec/fb_graph/connections/books_spec.rb
fb_graph-1.9.0 spec/fb_graph/connections/books_spec.rb
fb_graph-1.8.6 spec/fb_graph/connections/books_spec.rb
fb_graph-1.8.5 spec/fb_graph/connections/books_spec.rb
fb_graph-1.8.4 spec/fb_graph/connections/books_spec.rb
fb_graph-1.8.3 spec/fb_graph/connections/books_spec.rb
fb_graph-1.8.2 spec/fb_graph/connections/books_spec.rb