Sha256: 1aca5d8377a4f674d1b4202990a2529dfc3ba3381fc2f97918a0c5f596bc520f

Contents?: true

Size: 1.38 KB

Versions: 30

Compression:

Stored size: 1.38 KB

Contents

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

describe FbGraph::Connections::Photos, '#photos' do
  context 'when included by FbGraph::Album' do
    before do
      fake_json(:get, '12345/photos?access_token=access_token', 'albums/photos/matake_private')
    end

    it 'should return photos as FbGraph::Photo' do
      photos = FbGraph::Album.new('12345', :access_token => 'access_token').photos
      photos.each do |photo|
        photo.should be_instance_of(FbGraph::Photo)
      end
    end
  end
end

describe FbGraph::Connections::Photos, '#photo!' do
  before do
    fake_json(:post, '12345/photos', 'albums/photos/post_with_valid_access_token')
  end

  it 'should return generated photo' do
    photo = FbGraph::Album.new('12345', :access_token => 'valid').photo!(
      :image => Tempfile.new('image_file'),
      :message => 'Hello, where is photo?'
    )
    photo.identifier.should == 401111132276
    photo.name.should == 'Hello, where is photo?'
    photo.access_token.should == 'valid'
  end

  it 'should support Tag' do
    photo = FbGraph::Album.new('12345', :access_token => 'valid').photo!(
      :image => Tempfile.new('image_file'),
      :message => 'Hello, where is photo?',
      :tags => [FbGraph::Tag.new(:id => 12345, :name => 'me', :x => 0, :y => 10)]
    )
    photo.tags.should == [FbGraph::Tag.new(:id => 12345, :name => 'me', :x => 0, :y => 10)]
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.9 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.8 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.7 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.5 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.4 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.3 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.2 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.1 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.6.0 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.5 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.4 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.3 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.2 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.1 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.5.0 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.4.1 spec/fb_graph/connections/photos_spec.rb
fb_graph-1.4.0 spec/fb_graph/connections/photos_spec.rb