Sha256: b8fb0f4dd8a3a9334aadd941ac13a7587c0c87978ebe858ca9f12ee2912fd64a

Contents?: true

Size: 709 Bytes

Versions: 4

Compression:

Stored size: 709 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 eq address
    end
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
correios-cep-0.3.1 spec/correios/cep/address_finder_spec.rb
correios-cep-0.3.0 spec/correios/cep/address_finder_spec.rb
correios-cep-0.2.0 spec/correios/cep/address_finder_spec.rb
correios-cep-0.1.4 spec/correios/cep/address_finder_spec.rb