Sha256: 57895ac123a916f8260fe1be103f47ae74aba8b2f377ac2ea892bd8fd661412c

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 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
    Correios::CEP::WebService.any_instance.stub(:request!).with(cep).and_return(web_service_response)
    Correios::CEP::Parser.any_instance.stub(: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

3 entries across 3 versions & 1 rubygems

Version Path
correios-cep-0.1.3 spec/correios/cep/address_finder_spec.rb
correios-cep-0.1.2 spec/correios/cep/address_finder_spec.rb
correios-cep-0.1.1 spec/correios/cep/address_finder_spec.rb