Sha256: 9fa0b5535450b6db78ab67f642b013934c02f213eb5d39df0cd75b7d77bdef06

Contents?: true

Size: 1.96 KB

Versions: 15

Compression:

Stored size: 1.96 KB

Contents

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

describe FbGraph::Photo, '.new' do

  it 'should setup all supported attributes' do
    attributes = {
      :id => '12345',
      :from => {
        :id => '23456',
        :name => 'nov matake'
      },
      :tags => {
        :data => [{
          :id => '12345',
          :name => 'nov matake',
          :x => 32.5,
          :y => 27.7778,
          :created_time => '2010-01-10T15:37:40+0000'
        }]
      },
      :name => 'photo 1',
      :picture => 'http://www.facebook.com/matake/picture/album_size',
      :source => 'http://www.facebook.com/matake/picture/original_size',
      :height => 100,
      :width => 200,
      :link => 'http://www.facebook.com/photo/12345',
      :created_time => '2010-01-02T15:37:40+0000',
      :updated_time => '2010-01-02T15:37:41+0000'
    }
    photo = FbGraph::Photo.new(attributes.delete(:id), attributes)
    photo.identifier.should   == '12345'
    photo.from.should         == FbGraph::User.new('23456', :name => 'nov matake')
    photo.tags.should         == [FbGraph::Tag.new(
      '12345',
      :name => 'nov matake',
      :x => 32.5,
      :y => 27.7778,
      :created_time => '2010-01-10T15:37:40+0000'
    )]
    photo.picture.should      == 'http://www.facebook.com/matake/picture/album_size'
    photo.source.should       == 'http://www.facebook.com/matake/picture/original_size'
    photo.height.should       == 100
    photo.width.should        == 200
    photo.link.should         == 'http://www.facebook.com/photo/12345'
    photo.created_time.should == Time.parse('2010-01-02T15:37:40+0000')
    photo.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
  end

  it 'should support page as from' do
    page_photo = FbGraph::Photo.new('12345', :from => {
      :id => '23456',
      :name => 'Smart.fm',
      :category => 'Web Site'
    })
    page_photo.from.should == FbGraph::Page.new('23456', :name => 'Smart.fm', :category => 'Web Site')
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fb_graph-0.7.1 spec/fb_graph/photo_spec.rb
fb_graph-0.7.0 spec/fb_graph/photo_spec.rb
fb_graph-0.6.0 spec/fb_graph/photo_spec.rb
fb_graph-0.5.0 spec/fb_graph/photo_spec.rb
fb_graph-0.4.2 spec/fb_graph/photo_spec.rb
fb_graph-0.4.1 spec/fb_graph/photo_spec.rb
fb_graph-0.4.0 spec/fb_graph/photo_spec.rb
fb_graph-0.3.0 spec/fb_graph/photo_spec.rb
fb_graph-0.2.2 spec/fb_graph/photo_spec.rb
fb_graph-0.2.1 spec/fb_graph/photo_spec.rb
fb_graph-0.2.0 spec/fb_graph/photo_spec.rb
fb_graph-0.1.3 spec/fb_graph/photo_spec.rb
fb_graph-0.1.2 spec/fb_graph/photo_spec.rb
fb_graph-0.1.1 spec/fb_graph/photo_spec.rb
fb_graph-0.1.0 spec/fb_graph/photo_spec.rb