Sha256: 2880581f103dff5e7dbf659fee22a8f2b2db1db1e98cec595d39f29e415bf737

Contents?: true

Size: 1.91 KB

Versions: 4

Compression:

Stored size: 1.91 KB

Contents

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

describe FbGraph::Event do
  let :attributes do
    {
      :id => '12345',
      :owner => {
        :id => '23456',
        :name => 'nov matake'
      },
      :name => 'event 1',
      :description => 'an event for fb_graph test',
      :start_time => '2010-03-14T21:00:00+0000',
      :end_time => '2010-03-15T00:30:00+0000',
      :location => 'Smart.fm office',
      :venue => {
        :street => 'Sakuragaoka',
        :city => 'Shibuya',
        :state => 'Tokyo',
        :zip => '150-0031',
        :country => 'Japan',
        :latitude => '35.685',
        :longitude => '139.751'
      },
      :privacy => 'OPEN',
      :updated_time => '2010-01-02T15:37:41+0000'
    }
  end
  let(:event) { FbGraph::Event.new(attributes.delete(:id), attributes) }

  describe '.new' do
    it 'should setup all supported attributes' do
      event.identifier.should   == '12345'
      event.owner.should        == FbGraph::User.new('23456', :name => 'nov matake')
      event.name.should         == 'event 1'
      event.description.should  == 'an event for fb_graph test'
      event.start_time.should   == Time.parse('2010-03-14T21:00:00+0000')
      event.end_time.should     == Time.parse('2010-03-15T00:30:00+0000')
      event.location.should     == 'Smart.fm office'
      event.venue.should        == FbGraph::Venue.new(
        :street => 'Sakuragaoka',
        :city => 'Shibuya',
        :state => 'Tokyo',
        :zip => '150-0031',
        :country => 'Japan',
        :latitude => '35.685',
        :longitude => '139.751'
      )
      event.privacy.should      == 'OPEN'
      event.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
    end
  end

  describe '#update' do
    it 'should update existing event' do
      lambda do
        event.update(:location => 'Kyoto', :access_token => 'access_token')
      end.should request_to('12345', :post)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/event_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/event_spec.rb
fb_graph-1.6.9 spec/fb_graph/event_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/event_spec.rb