Sha256: 970ac86b24cd7edffe9bc6aebfc8687799b5f7072589684b1e52e95925a8117f

Contents?: true

Size: 1.53 KB

Versions: 14

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

describe FbGraph::Link, '.new' do

  it 'should setup all supported attributes' do
    attributes = {
      :id => '12345',
      :from => {
        :id => '23456',
        :name => 'nov matake'
      },
      :link => 'http://www.facebook.com/link/12345',
      :name => 'name',
      :caption => 'caption',
      :description => 'description',
      :icon => 'http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif',
      :picture => 'http://i.ytimg.com/vi/JA068qeB0oM/2.jpg',
      :message => 'check this out!',
      :created_time => '2010-01-02T15:37:41+0000'
    }
    link = FbGraph::Link.new(attributes.delete(:id), attributes)
    link.identifier.should   == '12345'
    link.from.should         == FbGraph::User.new('23456', :name => 'nov matake')
    link.link.should         == 'http://www.facebook.com/link/12345'
    link.name.should         == 'name'
    link.caption.should      == 'caption'
    link.description.should  == 'description'
    link.icon.should         == 'http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif'
    link.picture.should      == 'http://i.ytimg.com/vi/JA068qeB0oM/2.jpg'
    link.message.should      == 'check this out!'
    link.created_time.should == Time.parse('2010-01-02T15:37:41+0000')
  end

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

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fb_graph-1.8.6 spec/fb_graph/link_spec.rb
fb_graph-1.8.5 spec/fb_graph/link_spec.rb
fb_graph-1.8.4 spec/fb_graph/link_spec.rb
fb_graph-1.8.3 spec/fb_graph/link_spec.rb
fb_graph-1.8.2 spec/fb_graph/link_spec.rb
fb_graph-1.8.1 spec/fb_graph/link_spec.rb
fb_graph-1.8.0 spec/fb_graph/link_spec.rb
fb_graph-1.8.0.alpha2 spec/fb_graph/link_spec.rb
fb_graph-1.7.5 spec/fb_graph/link_spec.rb
fb_graph-1.8.0.alpha spec/fb_graph/link_spec.rb
fb_graph-1.7.4 spec/fb_graph/link_spec.rb
fb_graph-1.7.3 spec/fb_graph/link_spec.rb
fb_graph-1.7.2 spec/fb_graph/link_spec.rb
fb_graph-1.7.1 spec/fb_graph/link_spec.rb