Sha256: 7470fef6a9c7f15f07ce01ac8bee3acc85ca336f6a4d876a6d6910734c03a6b2

Contents?: true

Size: 1.96 KB

Versions: 104

Compression:

Stored size: 1.96 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Events, '#events' 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/events', 'users/events/matake_public', :status => [401, 'Unauthorized'] do
          lambda do
            FbGraph::User.new('matake').events
          end.should raise_exception(FbGraph::Unauthorized)
        end
      end
    end

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

describe FbGraph::Connections::Events, '#events!' do
  context 'when included by FbGraph::User' do
    it 'should return generated note' do
      mock_graph :post, 'matake/events', 'users/events/post_with_valid_access_token' 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
end

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.16 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.15 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.14 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.13 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.12 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.11 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.10 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.9 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.8 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.7 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.6 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.5 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.4 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.3 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.2 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.1 spec/fb_graph/connections/events_spec.rb
fb_graph-2.7.0 spec/fb_graph/connections/events_spec.rb
fb_graph-2.6.7 spec/fb_graph/connections/events_spec.rb
fb_graph-2.6.6 spec/fb_graph/connections/events_spec.rb