Sha256: 0471dff7996485946d1f82d1420e70c21d435cc3763f6a9f0bbb9e9ccd7f21a6

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true
describe Correios::CEP do
  describe '#web_service_url' do
    it 'default is Correios::CEP::Config::WEB_SERVICE_URL' do
      expect(Correios::CEP.web_service_url).to eq Correios::CEP::Config::WEB_SERVICE_URL
    end

    context 'when set web service URL' do
      let(:url) { 'http://ws.correios.com.br/cep' }

      around do |example|
        Correios::CEP.web_service_url = url
        example.run
        Correios::CEP.web_service_url = Correios::CEP::Config::WEB_SERVICE_URL
      end

      it 'returns the given web service URL' do
        expect(Correios::CEP.web_service_url).to eq url
      end
    end
  end

  describe "#request_timeout" do
    it "default is 5" do
      expect(Correios::CEP.request_timeout).to eq 5
    end

    context "when set timeout" do
      it "returns timeout" do
        Correios::CEP.request_timeout = 3
        expect(Correios::CEP.request_timeout).to eq 3
      end

      it "returns timeout in seconds (integer)" do
        Correios::CEP.request_timeout = 2.123
        expect(Correios::CEP.request_timeout).to eq 2
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
correios-cep-0.8.0 spec/correios/cep_spec.rb
correios-cep-0.7.1 spec/correios/cep_spec.rb
correios-cep-0.7.0 spec/correios/cep_spec.rb