Sha256: e05b6ed549a278ad7c5477cad0dcfdd14d87fbd06778871c302694638f6e82e0

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 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', 'true', :access_token => 'access_token', :params => {
          :member => 'member_id'
        } 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', 'true', :access_token => 'access_token', :params => {
          :member => 'member_id'
        } do
          FbGraph::FriendList.new('list_id', :access_token => 'access_token').unmember!(member).should be_true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/connections/members_spec.rb
fb_graph-2.7.16 spec/fb_graph/connections/members_spec.rb