Sha256: 4d07141e84a58eb6248b9c87702de5e1ebc7ac12c2a2fd06e8199ac3be9397a1

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe PictureFrom::FacebookPicture do

  describe '#picture_from_username' do
    subject { described_class.new }

    it 'returns the image url' do
      fake('http://graph.facebook.com/karreiro/picture',
           status: 302,
           message: 'Found',
           location: 'https://fbcdn-profile-a.akamaihd.net/image.png')

      link = subject.picture_from_username('karreiro')
      expect(link).to eq('http://graph.facebook.com/karreiro/picture')
    end
  end

  describe '#picture_from_user_info' do
    subject { described_class.new }

    it 'returns the image url' do
      fake('https://www.facebook.com/search.php?q=karreiro@gmail.com',
           file: 'facebook_crawler.response')

      link = subject.picture_from_user_info('karreiro@gmail.com')
      expect(link).to eq('http://graph.facebook.com/karreiro/picture')
    end
  end

  describe 'online tests', online: true do

    describe '#picture_from_user_info' do
      subject { described_class.new }

      it 'returns the image url' do
        link = subject.picture_from_user_info('Mark Zuckerberg')
        expect(link).to eq('http://graph.facebook.com/zuck/picture')
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picture_from-1.0.1 spec/lib/picture_from/facebook_picture_spec.rb