Sha256: ef54a149eeca53bbba1af6ce1da1b1d98e1acafbc33158fbbf7cecdc21d7451f

Contents?: true

Size: 654 Bytes

Versions: 1

Compression:

Stored size: 654 Bytes

Contents

# encoding: UTF-8
require 'spec_helper'

describe Correios::SRO::WebService do
  describe "#request" do
    let(:sro) { Correios::SRO::Rastreador.new }
    let(:web_service) { Correios::SRO::WebService.new }

    it "encodes from ISO-8859-1 to UTF-8" do
      response = double("response", :body => "<xml><fake></fake>")
      response.body.should_receive(:backward_encode).with("UTF-8", "ISO-8859-1")
      Net::HTTP.stub(:post_form).and_return(response)
      web_service.request(sro)
    end

    it "returns XML response" do
      fake_request_for("<xml><fake></fake>")
      web_service.request(sro).should == "<xml><fake></fake>"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
correios-sro-xml-0.0.3 spec/correios/sro/web_service_spec.rb