test/alipay/wap/notify_test.rb in alipay-0.13.0 vs test/alipay/wap/notify_test.rb in alipay-0.14.0
- old
+ new
@@ -14,19 +14,25 @@
query = [ :service, :v, :sec_id, :notify_data ].map {|key| "#{key}=#{@notify_params[key]}"}.join('&')
@sign_params = @notify_params.merge(sign: Digest::MD5.hexdigest("#{query}#{Alipay.key}"))
end
def test_unsign_notify
- FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}", body: "true")
+ stub_request(
+ :get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}"
+ ).to_return(body: "true")
assert !Alipay::Wap::Notify.verify?(@notify_params)
end
def test_verify_notify_when_true
- FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}", body: "true")
+ stub_request(
+ :get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}"
+ ).to_return(body: "true")
assert Alipay::Wap::Notify.verify?(@sign_params)
end
def test_verify_notify_when_false
- FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}", body: "false")
+ stub_request(
+ :get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}¬ify_id=#{@notify_id}"
+ ).to_return(body: "false")
assert !Alipay::Wap::Notify.verify?(@sign_params)
end
end