Sha256: 2d30725f959029ccb94546e02a7cd3b066c5ca59986eceb473e9bcc742adfe50

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
fb_graph-1.7.1 spec/fb_graph/connections/photos_spec.rb