@@ -52,7 +52,7 @@ class XmlTest < Minitest::Test
5252
5353 it "should raise Key validation error" do
5454 decoded_response . sub! ( "<ds:DigestValue>pJQ7MS/ek4KRRWGmv/H43ReHYMs=</ds:DigestValue>" ,
55- "<ds:DigestValue>b9xsAXLsynugg3Wc1CI3kpWku+0=</ds:DigestValue>" )
55+ "<ds:DigestValue>b9xsAXLsynugg3Wc1CI3kpWku+0=</ds:DigestValue>" )
5656 mod_document = RubySaml ::XML ::SignedDocument . new ( decoded_response )
5757 base64cert = mod_document . elements [ "//ds:X509Certificate" ] . text
5858 exception = assert_raises ( RubySaml ::ValidationError ) do
@@ -63,13 +63,14 @@ class XmlTest < Minitest::Test
6363 end
6464
6565 it "correctly obtain the digest method with alternate namespace declaration" do
66- adfs_document = RubySaml ::XML ::SignedDocument . new ( fixture ( :adfs_response_xmlns , false ) )
67- base64cert = adfs_document . elements [ "//X509Certificate" ] . text
66+ adfs_document = fixture ( :adfs_response_xmlns , false )
67+ base64cert = adfs_document [ %r{<X509Certificate>(.*?)</X509Certificate>} , 1 ]
68+ adfs_document = RubySaml ::XML ::SignedDocument . new ( adfs_document )
6869 assert adfs_document . validate_signature ( base64cert , false )
6970 end
7071
7172 it "raise validation error when the X509Certificate is missing and no cert provided" do
72- decoded_response . sub! ( / <ds:X509Certificate>.*<\ / ds:X509Certificate>/ , "" )
73+ decoded_response . sub! ( %r{ <ds:X509Certificate>.*</ds:X509Certificate>} , '' )
7374 mod_document = RubySaml ::XML ::SignedDocument . new ( decoded_response )
7475 exception = assert_raises ( RubySaml ::ValidationError ) do
7576 mod_document . validate_document ( "a fingerprint" , false ) # The fingerprint isn't relevant to this test
0 commit comments