Sha256: ce07770bcd449195089a6eb73e16c5dcc40a14601e089e00c183b95c2e8bce52

Contents?: true

Size: 1.87 KB

Versions: 16

Compression:

Stored size: 1.87 KB

Contents

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

context 'when included by FbGraph::User' do
  describe FbGraph::Connections::Events, '#events' 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',
          :access_token => 'access_token',
          :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

  describe FbGraph::Connections::Events, '#events!' do
    before do
      fake_json(:post, 'matake/events', 'users/events/post_with_valid_access_token')
    end

    it 'should return generated note' do
      event = FbGraph::User.new('matake', :access_token => 'valid').event!(
        :name => 'FbGraph test event',
        :start_time => Time.utc(2010, 5, 11, 10, 0, 0).to_i,
        :end_time   => Time.utc(2010, 5, 11, 12, 0, 0).to_i
      )
      event.name.should == 'FbGraph test event'
      event.access_token.should == 'valid'
      event.start_time.should == Time.utc(2010, 5, 11, 10, 0, 0)
      event.end_time.should == Time.utc(2010, 5, 11, 12, 0, 0)
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
fb_graph-1.0.7 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.6 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.5 spec/fb_graph/connections/events_spec.rb
palidanx-fb_graph-1.0.4 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.4 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.3 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.2 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.1 spec/fb_graph/connections/events_spec.rb
fb_graph-1.0.0 spec/fb_graph/connections/events_spec.rb
fb_graph-0.8.0 spec/fb_graph/connections/events_spec.rb
fb_graph-0.7.3 spec/fb_graph/connections/events_spec.rb
fb_graph-0.7.2 spec/fb_graph/connections/events_spec.rb
fb_graph-0.7.1 spec/fb_graph/connections/events_spec.rb
fb_graph-0.7.0 spec/fb_graph/connections/events_spec.rb
fb_graph-0.6.0 spec/fb_graph/connections/events_spec.rb
fb_graph-0.5.0 spec/fb_graph/connections/events_spec.rb