Sha256: 6daeacf67455a3c94d6414ecc8cdeb56cdbd17d46e6cb3975abb1a5f7e3410c8

Contents?: true

Size: 1015 Bytes

Versions: 8

Compression:

Stored size: 1015 Bytes

Contents

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

describe FbGraph::Connections::Groups, '#groups' do
  context 'when included by FbGraph::User' do
    before(:all) do
      fake_json(:get, 'matake/groups', 'users/groups/matake_public')
      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',
          :name => 'iPhone 3G S'
        )
        groups.each do |group|
          group.should be_instance_of(FbGraph::Group)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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