Sha256: 29800889222536b91313eea870562da6d0b9a61061ee33c0d0be72dda68132b7
Contents?: true
Size: 980 Bytes
Versions: 2
Compression:
Stored size: 980 Bytes
Contents
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'spec' require 'spec/autorun' require 'fakeweb' require 'mooamba' Spec::Runner.configure do |config| FakeWeb.allow_net_connect = false end VALID_ZIP_CODES = %w(04548-040 01310-100) INVALID_ZIP_CODES = %w(0 00) def map_parameters_to_file(options, file) parameters = { :sCepOrigem => options[:from].gsub("-", ""), :sCepDestino => options[:to].gsub("-", ""), :nVlPeso => options[:weight], :StrRetorno => "XML" }.merge Mooamba::Sedex::DEFAULT_PARAMS FakeWeb.register_uri(:get, URI.escape(Mooamba::Correios::API_URL + parameters.to_query_string), :body => data(file).read) end def valid_xml_file data "valid" end def data(name) File.open("#{File.dirname(__FILE__)}/data/#{name}.xml") end class Hash def except(*blacklist) {}.tap do |h| (keys - blacklist).each { |k| h[k] = self[k] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mooamba-0.0.2 | spec/spec_helper.rb |
mooamba-0.0.1 | spec/spec_helper.rb |