Sha256: 004b3e59e514770cc2f7851a8a0b690e44798545c420921502c3c748b0c624d9

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe GoMaps::CEP do
  context 'given valid cep' do
    before :each do
      map_url_to_file 'http://www.buscarcep.com.br/?formato=xml&cep=01310-000', 'cep_success'
      @cep = GoMaps::CEP.new('01310-000')
    end

    context 'on #street' do
      it 'should return the street' do
        @cep.street.should eql('Avenida Paulista')
      end
    end

    context 'on #city' do
      it 'should return the city' do
        @cep.city.should eql('São Paulo')
      end
    end
  end

  context 'given invalid cep' do
    it 'should raise AddressNotFoundException' do
      map_url_to_file 'http://www.buscarcep.com.br/?formato=xml&cep=12345-678', 'cep_error'
      lambda { @cep = GoMaps::CEP.new('12345-678') }.should raise_error(GoMaps::AddressNotFoundException)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
go_maps-0.3.1 spec/go_maps/cep_spec.rb
go_maps-0.3.0 spec/go_maps/cep_spec.rb