Sha256: 0250fd75c37d26d051afc16eaf574ed9375c895320fd005f48081e26263c9cd0

Contents?: true

Size: 1.75 KB

Versions: 70

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Members do
  let :member do
    FbGraph::User.new('member_id')
  end

  context 'when included in FbGraph::Group' do
    describe '#members' do
      it 'should return members as FbGraph::User' do
        mock_graph :get, 'emacs/members', 'groups/members/emacs_private', :access_token => 'access_token' do
          users = FbGraph::Group.new('emacs', :access_token => 'access_token').members
          users.each do |user|
            user.should be_instance_of FbGraph::User
          end
        end
      end
    end

    describe '#member!' do
      it :NOT_SUPPORTED_YET
    end

    describe '#unmember!' do
      it :NOT_SUPPORTED_YET
    end
  end

  context 'when included in FbGraph::FriendList' do
    describe '#members' do
      it 'should return members as FbGraph::User' do
        mock_graph :get, 'list_id/members', 'friend_lists/members/sample', :access_token => 'access_token' do
          users = FbGraph::FriendList.new('list_id', :access_token => 'access_token').members
          users.each do |user|
            user.should be_instance_of FbGraph::User
          end
        end
      end
    end

    describe '#member!' do
      it 'should return true' do
        mock_graph :post, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
          FbGraph::FriendList.new('list_id', :access_token => 'access_token').member!(member).should be_true
        end
      end
    end

    describe '#unmember!' do
      it 'should return true' do
        mock_graph :delete, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
          FbGraph::FriendList.new('list_id', :access_token => 'access_token').unmember!(member).should be_true
        end
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
fb_graph-2.2.3 spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.2 spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.1 spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.0 spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.0.beta spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.0.alpha2 spec/fb_graph/connections/members_spec.rb
fb_graph-2.2.0.alpha spec/fb_graph/connections/members_spec.rb
fb_graph-2.1.13 spec/fb_graph/connections/members_spec.rb
fb_graph-2.1.12 spec/fb_graph/connections/members_spec.rb
fb_graph-2.1.11 spec/fb_graph/connections/members_spec.rb