Sha256: fd840f29973d3a0a5dfb78354dcfc3f64deb69427884c223c5d8faa5d0816f78

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Books, '#books' do
  context 'when included by FbGraph::User' do
    before do
      fake_json(:get, 'matake/books', 'users/books/matake_public', :status => [401, 'Unauthorized'])
      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

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-1.7.1 spec/fb_graph/connections/books_spec.rb