Commit 532a0ca

mo <mo.khan@gmail.com>
2018-02-26 01:55:09
use nokogiri to parse version attribute.
1 parent bdc4a9e
Changed files (2)
lib
saml
spec
lib/saml/kit/document.rb
@@ -39,7 +39,7 @@ module Saml
 
       # Returns the Version of the SAML document.
       def version
-        root.fetch('Version', {})
+        at_xpath('./*/@Version').try(:value)
       end
 
       # Returns the Destination of the SAML document.
spec/saml/kit/document_spec.rb
@@ -11,6 +11,7 @@ RSpec.describe Saml::Kit::Document do
 
   specify { expect(subject.id).to eql(id) }
   specify { expect(subject.issuer).to eql(issuer) }
+  specify { expect(subject.version).to eql("2.0") }
 
   describe '.to_saml_document' do
     subject { described_class }