Sha256: d95b5f85b5c0ac5daba7f1427a3e2e433f6c1a3718ef7d0bd789d161c9e11e20

Contents?: true

Size: 1.32 KB

Versions: 63

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Senders, '#senders' do
  it 'should return senders as FbGraph::User' do
    mock_graph :get, '12345/senders', 'thread/senders/private', :params => {:no_cache => 'true'}, :access_token => 'access_token' do
      senders = FbGraph::Thread.new(12345, :access_token => 'access_token').senders(:no_cache => true)
      senders.each do |sender|
        sender.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', :senders => {}) }

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

      context 'when options are specified' do
        it 'should not use cache' do
          lambda do
            thread.senders(:no_cache => true)
          end.should request_to '12345/senders?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.senders
        end.should request_to '12345/senders?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/senders_spec.rb
fb_graph-2.7.16 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.15 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.14 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.13 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.12 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.11 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.10 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.9 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.8 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.7 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.6 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.5 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.4 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.3 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.2 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.1 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.7.0 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.6.7 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.6.6 spec/fb_graph/connections/senders_spec.rb