Sha256: 87c381990e0eb3afba54f2b5fb3a9397ec56a83134175cd334eac15522bf0e98
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require 'test_helper' class CanadaPostPwsTest < Minitest::Test def setup credentials = { platform_id: 123, api_key: '456', secret: '789' } @cp = CanadaPostPWS.new(credentials) end def test_get_sanitized_postal_code_location_nil postal_code = @cp.send(:get_sanitized_postal_code, nil) assert_nil postal_code end def test_get_sanitized_postal_code_postal_code_nil location = Location.new(name: 'Test test') assert_nil location.postal_code postal_code = @cp.send(:get_sanitized_postal_code, location) assert_nil postal_code end def test_get_sanitized_postal_code_spaces location = Location.new(postal_code: ' K2P 1L4 ') postal_code = @cp.send(:get_sanitized_postal_code, location) assert_equal 'K2P1L4', postal_code end def test_get_sanitized_postal_code_lowercase location = Location.new(postal_code: 'k2p 1l4') postal_code = @cp.send(:get_sanitized_postal_code, location) assert_equal 'K2P1L4', postal_code end def test_get_sanitzied_postal_code_proper location = Location.new(postal_code: 'K2P1L4') postal_code = @cp.send(:get_sanitized_postal_code, location) assert_equal 'K2P1L4', postal_code end def test_get_sanitzied_postal_code_does_not_alter_original location = Location.new(postal_code: 'K2P 1l4') assert_equal 'K2P 1l4', location.postal_code @cp.send(:get_sanitized_postal_code, location) assert_equal 'K2P 1l4', location.postal_code end end
Version data entries
4 entries across 4 versions & 1 rubygems