Sha256: 5b1d568b288b35bf45b834ed7a22148df4ab2d7f3c2925d74c856a169f9b865f
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
module ActionController class Response # Returns true if this response is well-formed XML, follows the TML syntactic rules, and has a format :rtml_helpers or :tml. # Raises an error if any of these are false. def valid_tml? unless template.template_format == :rtml || template.template_format == :tml raise "Expected format to be :rtml or :tml, found #{template.template_format.inspect}" end body.valid_tml? end # Verifies that the produced TML resembles the given structure. See +Rtml::Rules::DomValidation#validate_tml_dom+ # for more information. def tml_should_resemble(structure) body.validate_tml_structure(structure) end # Verifies that the produced TML does NOT resemble the given structure. # See +Rtml::Rules::DomValidation#validate_tml_dom+ for more information. def tml_should_not_resemble(structure) inspected = structure.inspect begin body.validate_tml_structure(structure) rescue return true end raise Rtml::Errors::ProcessingError, "TML was expected not to resemble #{inspected}, but it did!", caller end end end
Version data entries
4 entries across 4 versions & 1 rubygems