Sha256: b848877e75d46957aacaca63f2fd591a22d946ccd2b462f353eba64d5f0f3347
Contents?: true
Size: 974 Bytes
Versions: 2
Compression:
Stored size: 974 Bytes
Contents
require 'test_helper' class JdPay::UtilTest < Minitest::Test def setup @params = {he: 'zhi', zhi: 'he', meng: nil} end def test_denilize assert_equal @params.merge(meng: ""), JdPay::Util.denilize(@params) end def test_to_xml xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><jdpay><he>zhi</he><zhi>he</zhi><meng></meng></jdpay>" assert_equal xml, JdPay::Util.to_xml(@params) end def test_to_uri uri = "he=zhi&meng=&zhi=he" assert_equal uri, JdPay::Util.to_uri(@params) end def test_build_pay_form url = "https://wepay.jd.com/jdpay/saveOrder" str = "<html><body onload=document.getElementById('payForm').submit(); style='display: none;'><form action=https://wepay.jd.com/jdpay/saveOrder method='post' id='payForm'><input type='text' name=he value=zhi><input type='text' name=zhi value=he><input type='text' name=meng value=></form></body></html>" assert_equal str, JdPay::Util.build_pay_form(url, @params) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jdpay-0.1.2 | test/jd_pay/util_test.rb |
jdpay-0.1.1 | test/jd_pay/util_test.rb |