Sha256: da475a42d3dd26693503f9e1bcea82d29e54a7b470fe49875738f1e26ccc3069

Contents?: true

Size: 1.88 KB

Versions: 60

Compression:

Stored size: 1.88 KB

Contents

require '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

60 entries across 60 versions & 1 rubygems

Version Path
fb_graph-2.4.7 spec/fb_graph/event_spec.rb
fb_graph-2.4.6 spec/fb_graph/event_spec.rb
fb_graph-2.4.4 spec/fb_graph/event_spec.rb
fb_graph-2.4.3 spec/fb_graph/event_spec.rb
fb_graph-2.4.2 spec/fb_graph/event_spec.rb
fb_graph-2.4.1 spec/fb_graph/event_spec.rb
fb_graph-2.4.0 spec/fb_graph/event_spec.rb
fb_graph-2.3.2 spec/fb_graph/event_spec.rb
fb_graph-2.3.1 spec/fb_graph/event_spec.rb
fb_graph-2.3.0 spec/fb_graph/event_spec.rb
fb_graph-2.2.6 spec/fb_graph/event_spec.rb
fb_graph-2.2.5 spec/fb_graph/event_spec.rb
fb_graph-2.2.4 spec/fb_graph/event_spec.rb
fb_graph-2.2.3 spec/fb_graph/event_spec.rb
fb_graph-2.2.2 spec/fb_graph/event_spec.rb
fb_graph-2.2.1 spec/fb_graph/event_spec.rb
fb_graph-2.2.0 spec/fb_graph/event_spec.rb
fb_graph-2.2.0.beta spec/fb_graph/event_spec.rb
fb_graph-2.2.0.alpha2 spec/fb_graph/event_spec.rb
fb_graph-2.2.0.alpha spec/fb_graph/event_spec.rb