Sha256: 22bbb555608ee7ffa5d5876213a102fa9132f149a531225f4f47e3c0814842a8

Contents?: true

Size: 1.67 KB

Versions: 88

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Blocked do
  let(:page) { FbGraph::Page.new(117513961602338, :access_token => 'access_token') }
  let(:user) { FbGraph::User.new(579612276) }

  describe '#blocked' do
    it 'should return blocked users as FbGraph::User' do
      mock_graph :get, '117513961602338/blocked', 'pages/blocked/index', :access_token => 'access_token' do
        users = page.blocked
        users.each do |user|
          user.should be_a FbGraph::User
        end
      end
    end
  end

  describe '#blocked?' do
    context 'when blocked' do
      it 'should retrun true' do
        mock_graph :get, '117513961602338/blocked/579612276', 'pages/blocked/show_blocked', :access_token => 'access_token' do
          page.blocked?(user).should be_true
        end
      end
    end

    context 'otherwise' do
      it 'should retrun false' do
        mock_graph :get, '117513961602338/blocked/579612276', 'pages/blocked/show_non_blocked', :access_token => 'access_token' do
          page.blocked?(user).should be_false
        end
      end
    end
  end

  describe '#block!' do
    it 'should return blocked users as FbGraph::User' do
      mock_graph :post, '117513961602338/blocked', 'pages/blocked/create', :access_token => 'access_token', :params => {
        :uid => '579612276'
      } do
        blocked = page.block! user
        blocked.each do |user|
          user.should be_a FbGraph::User
        end
      end
    end
  end

  describe '#unblock!' do
    it 'should return true' do
      mock_graph :delete, '117513961602338/blocked/579612276', 'true', :access_token => 'access_token' do
        page.unblock!(user).should be_true
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
fb_graph-2.4.16 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.15 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.14 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.13 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.12 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.11 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.10 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.9 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.8 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.7 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.6 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.4 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.3 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.2 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.1 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.4.0 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.3.2 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.3.1 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.3.0 spec/fb_graph/connections/blocked_spec.rb
fb_graph-2.2.6 spec/fb_graph/connections/blocked_spec.rb