Skip to content

Commit 327d4e1

Browse files
author
Rob Fletcher
committed
add test and remove version bump
1 parent f1a21c7 commit 327d4e1

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

lib/onelogin/ruby-saml/response.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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

lib/onelogin/ruby-saml/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module OneLogin
22
module RubySaml
3-
VERSION = '0.8.2'
3+
VERSION = '0.8.1'
44
end
55
end

test/response_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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('')

0 commit comments

Comments
 (0)