Sha256: bd1f00e7f3fe1aa68c791b628c08eb0a4f1b1d6d644046c4e077a075e4e3e419

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

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

describe FbGraph::Connections::Groups, '#groups' do
  context 'when included by FbGraph::User' do
    before do
      fake_json(:get, 'matake/groups', 'users/groups/matake_public', :status => [401, 'Unauthorized'])
      fake_json(:get, 'matake/groups?access_token=access_token', 'users/groups/matake_private')
    end

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

    context 'when access_token is given' do
      it 'should return groups as FbGraph::Group' do
        groups = FbGraph::User.new('matake', :access_token => 'access_token').groups
        groups.first.should == FbGraph::Group.new(
          '115286585902',
          :access_token => 'access_token',
          :name => 'iPhone 3G S'
        )
        groups.each do |group|
          group.should be_instance_of(FbGraph::Group)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/connections/groups_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/connections/groups_spec.rb
fb_graph-1.6.9 spec/fb_graph/connections/groups_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/connections/groups_spec.rb
fb_graph-1.6.8 spec/fb_graph/connections/groups_spec.rb