Sha256: 1e12d29d9dbd9fa8c852f6c2229d746390b7331bc1ff508565937b180f4a7682

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

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

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

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

    context 'when access_token is given' do
      it 'should return events as FbGraph::Event' do
        events = FbGraph::User.new('matake', :access_token => 'access_token').events
        events.first.should == FbGraph::Event.new(
          '116600818359630',
          :name => 'The Loyal We @ Rainy Day Bookstore and Cafe',
          :start_time => '2010-04-29T01:30:00+0000',
          :end_time => '2010-04-29T04:30:00+0000',
          :location => 'Nishi Azabu'
        )
        events.each do |event|
          event.should be_instance_of(FbGraph::Event)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-0.0.8 spec/fb_graph/connections/events_spec.rb