Sha256: 9af5ededb5ef90772d10fdcdac11a569122ce3a8f01f8707975608b604e587ab

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

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

context 'when included by FbGraph::User' do
  describe FbGraph::Connections::Albums, '#albums' do
    before(:all) do
      fake_json(:get, 'matake/albums', 'users/albums/matake_public')
      fake_json(:get, 'matake/albums?access_token=access_token', 'users/albums/matake_private')
    end

    context 'when no access_token given' do
      it 'should raise FbGraph::Unauthorized' do
        lambda do
          FbGraph::User.new('matake').albums
        end.should raise_exception(FbGraph::Unauthorized)
      end
    end

    context 'when access_token is given' do
      it 'should return albums as FbGraph::Album' do
        albums = FbGraph::User.new('matake', :access_token => 'access_token').albums
        albums.first.should == FbGraph::Album.new(
          '19351532276',
          :from => {
            :id => '579612276',
            :name => 'Nov Matake'
          },
          :name => 'モバイルアップロード',
          :link => 'http://www.facebook.com/album.php?aid=25463&id=579612276',
          :count => 3,
          :created_time => '2008-07-27T11:38:15+0000',
          :updated_time => '2009-02-07T16:09:53+0000'
        )
        albums.each do |album|
          album.should be_instance_of(FbGraph::Album)
        end
      end
    end
  end

  describe FbGraph::Connections::Albums, '#album!' do
    before do
      fake_json(:post, 'matake/albums', 'users/albums/post_with_valid_access_token')
    end

    it 'should return generated album' do
      album = FbGraph::User.new('matake', :access_token => 'valid').album!(
        :name => 'FbGraph test',
        :message => 'test test test'
      )
      album.identifier.should == 401096332276
      album.name.should == 'FbGraph test'
      album.description.should == 'test test test'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fb_graph-0.2.2 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.2.1 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.2.0 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.1.3 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.1.2 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.1.1 spec/fb_graph/connections/albums_spec.rb
fb_graph-0.1.0 spec/fb_graph/connections/albums_spec.rb