Sha256: 71e8876141715dc0a7e8df620914567dfce352f2c0c8e121c4c0cd2fb5b1de98

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper'

describe CareerBuilder::Resume do

  context 'when fetching the full resume generates a connection error' do

    let(:resume) { CareerBuilder::Resume.new(client, partial_resume) }

    let(:client) { CareerBuilder::Client.new('valid_email', 'valid_password') }
    let(:partial_resume) { double(:id => 42) }
    let(:full_resume) { double(:contact_email => 'foo@bar.com') }

    before do
      client.should_receive(:get_resume).once.and_raise(Errno::ECONNRESET)
      client.should_receive(:get_resume).at_most(:once).and_return(full_resume)
    end

    it 'retries, working around the connection errors' do
      resume.real_contact_email.should == 'foo@bar.com'
    end

    it 'uses connection_retry_count to determine how many times to retry' do
      client.connection_retry_count = 0

      expect {
        resume.real_contact_email
      }.to raise_error(Errno::ECONNRESET)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
career_builder-0.2.2 spec/career_builder/resume_spec.rb