Sha256: 2f360b073eba0cc0ad60dca86a1d87d804554b0b38abe6496fd144ff7cf06d57

Contents?: true

Size: 1.22 KB

Versions: 14

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe FbGraph2::Edge::Picture do
  context 'included in User' do
    describe '#picture' do
      let(:me) { FbGraph2::User.me('token') }

      it do
        mock_graph :get, 'me/picture', 'user/picture', access_token: 'token', params: {
          redirect: false
        } do
          me.picture
        end.should be_instance_of FbGraph2::Struct::Picture
      end

      context 'when cached' do
        let(:me_with_picture) do
          mock_graph :get, 'me', 'user/with_picture', access_token: 'token', params: {
            fields: 'picture'
          } do
            me.fetch fields: 'picture'
          end
        end

        context 'with option params' do
          it 'should not use cache' do
            mock_graph :get, '579612276/picture', 'user/picture', access_token: 'token', params: {
              redirect: false,
              type: 'square'
            } do
              me_with_picture.picture :square
            end
          end
        end

        context 'without option params' do
          it 'should use cache' do
            expect do
              me_with_picture.picture
            end.not_to request_to '579612276/picture'
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fb_graph2-1.3.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-1.2.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-1.1.1 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-1.1.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-1.0.1 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-1.0.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.9.1 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.9.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.8.0 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.7.9 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.7.8 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.7.7 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.7.6 spec/fb_graph2/edge/picture_spec.rb
fb_graph2-0.7.5 spec/fb_graph2/edge/picture_spec.rb