File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,9 +144,14 @@ def validate_structure(soft = true)
144144 @xml = Nokogiri ::XML ( self . document . to_s )
145145 end
146146 if soft
147- @schema . validate ( @xml ) . map { @errors << "Schema validation failed" ; return false }
147+ @schema . validate ( @xml ) . map {
148+ @errors << "Schema validation failed" ;
149+ return false
150+ }
148151 else
149- @schema . validate ( @xml ) . map { |error | @errors << "#{ error . message } \n \n #{ @xml . to_s } " ; validation_error ( "#{ error . message } \n \n #{ @xml . to_s } " ) }
152+ @schema . validate ( @xml ) . map { |error | @errors << "#{ error . message } \n \n #{ @xml . to_s } " ;
153+ validation_error ( "#{ error . message } \n \n #{ @xml . to_s } " )
154+ }
150155 end
151156 end
152157
Original file line number Diff line number Diff line change 11module OneLogin
22 module RubySaml
3- VERSION = '0.8.2 '
3+ VERSION = '0.8.1 '
44 end
55end
Original file line number Diff line number Diff line change @@ -53,6 +53,14 @@ class RubySamlTest < Test::Unit::TestCase
5353 end
5454 end
5555
56+ context "#validate_structure" do
57+ should "raise when encountering a condition that prevents the document from being valid" do
58+ response = OneLogin ::RubySaml ::Response . new ( response_document_2 )
59+ response . send ( :validate_structure )
60+ assert response . errors . include? "Schema validation failed"
61+ end
62+ end
63+
5664 context "#is_valid?" do
5765 should "return false when response is initialized with blank data" do
5866 response = OneLogin ::RubySaml ::Response . new ( '' )
You can’t perform that action at this time.
0 commit comments