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.4.16 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.15 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.14 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.13 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.12 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.11 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.10 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.9 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.8 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.7 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.6 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.4 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.3 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.2 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.1 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.4.0 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.3.2 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.3.1 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.3.0 spec/fb_graph/connections/senders_spec.rb
fb_graph-2.2.6 spec/fb_graph/connections/senders_spec.rb