Module: Html::Test::Assertions
- Included in:
- ActionController::Integration::Session, LinkValidator, ValidateFilter, Test::Unit::TestCase
- Defined in:
- lib/assertions.rb
Instance Method Summary collapse
- #assert_tidy(body = nil) ⇒ Object
- #assert_validates(types = nil, body = nil, url = nil, options = {}) ⇒ Object
- #assert_w3c(body = nil) ⇒ Object
- #assert_xmllint(body = nil) ⇒ Object
Instance Method Details
#assert_tidy(body = nil) ⇒ Object
4 5 6 |
# File 'lib/assertions.rb', line 4 def assert_tidy(body = nil) assert_validates(:tidy, body) end |
#assert_validates(types = nil, body = nil, url = nil, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/assertions.rb', line 16 def assert_validates(types = nil, body = nil, url = nil, = {}) verbose = ( [:verbose] ) ? [:verbose] : Html::Test::Validator.verbose body ||= @response.body types ||= [:tidy, :w3c, :xmllint] types = [types] if !types.is_a?(Array) types.each do |t| log("validating #{url} with #{t} ... ") if verbose error = Html::Test::Validator.send("#{t}_errors", body) if error.nil? log("OK\n") if verbose else log("FAILURE\n") if verbose = "Validator #{t} failed" << " for url #{url}" if url << " with message '#{error}'" # Why would I want to print this in the log file??? # Rails.logger.error(assert_message + " for response body:\n #{with_line_counts(body)}") assert(error.nil?, ) end end end |
#assert_w3c(body = nil) ⇒ Object
8 9 10 |
# File 'lib/assertions.rb', line 8 def assert_w3c(body = nil) assert_validates(:w3c, body) end |
#assert_xmllint(body = nil) ⇒ Object
12 13 14 |
# File 'lib/assertions.rb', line 12 def assert_xmllint(body = nil) assert_validates(:xmllint, body) end |