Sha256: 2eae684de11b646931027001621b0968eac51070d60ffafde9e6d00105d69635

Contents?: true

Size: 1.4 KB

Versions: 63

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Participants, '#participants' do
  it 'should return participants as FbGraph::User' do
    mock_graph :get, '12345/participants', 'thread/participants/private', :params => {:no_cache => 'true'}, :access_token => 'access_token' do
      participants = FbGraph::Thread.new(12345, :access_token => 'access_token').participants(:no_cache => true)
      participants.each do |participant|
        participant.should be_instance_of(FbGraph::User)
      end
    end
  end

  describe 'cached messages' do
    context 'when cached' do
      let(:thread) { FbGraph::Thread.new(12345, :access_token => 'access_token', :participants => {}) }

      it 'should use cache' do
        lambda do
          thread.participants
        end.should_not request_to '12345/participants?access_token=access_token'
      end

      context 'when options are specified' do
        it 'should not use cache' do
          lambda do
            thread.participants(:no_cache => true)
          end.should request_to '12345/participants?access_token=access_token&no_cache=true'
        end
      end
    end

    context 'otherwise' do
      let(:thread) { FbGraph::Thread.new(12345, :access_token => 'access_token') }

      it 'should not use cache' do
        lambda do
          thread.participants
        end.should request_to '12345/participants?access_token=access_token'
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.16 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.15 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.14 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.13 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.12 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.11 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.10 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.9 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.8 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.7 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.6 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.5 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.4 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.3 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.2 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.1 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.7.0 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.6.7 spec/fb_graph/connections/participants_spec.rb
fb_graph-2.6.6 spec/fb_graph/connections/participants_spec.rb