Sha256: ad30aa3f9d8356373c6030313403e135a6ed9747b8ccd2ace943838b623585f7

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

require 'spec_helper'

describe Correios::CEP::AddressFinder do
  let(:cep) { '54250610' }
  let(:web_service_response) { '<end>Rua Fernando Amorim</end>' }
  let(:address) { { address: 'Rua Fernando Amorim' } }

  before do
    allow_any_instance_of(Correios::CEP::WebService).to receive(:request).with(cep).and_return(web_service_response)
    allow_any_instance_of(Correios::CEP::Parser).to receive(:address).with(web_service_response).and_return(address)
  end

  describe '#get' do
    it 'returns address' do
      expect(subject.get(cep)).to eql address
    end
  end

  describe '.get' do
    it 'returns address' do
      expect(Correios::CEP::AddressFinder.get(cep)).to eql address
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
correios-cep-0.4.0 spec/correios/cep/address_finder_spec.rb
correios-cep-0.3.3 spec/correios/cep/address_finder_spec.rb
correios-cep-0.3.2 spec/correios/cep/address_finder_spec.rb