Sha256: dd982ac63695604563998ee2acb0c663126f26cf39de61a2f246892d6d69bf11
Contents?: true
Size: 828 Bytes
Versions: 4
Compression:
Stored size: 828 Bytes
Contents
def be_a_valid_grxml_document SpeechDocMatcher.new 'GRXML', GRXML_SCHEMA end def be_a_valid_ssml_document SpeechDocMatcher.new 'SSML', SSML_SCHEMA end class SpeechDocMatcher attr_reader :subject, :type, :schema def initialize(type, schema) @type, @schema = type, schema end def subject=(s) @subject = Nokogiri::XML(s.to_xml) end def failure_message " expected #{subject} to be a valid #{type} document\n#{errors}" end def failure_message_when_negated " expected #{subject} not to be a valid #{type} document" end def description "to be a valid #{type} document" end def matches?(s) self.subject = s schema.valid? subject end def does_not_match?(s) !matches? s end private def errors schema.validate(subject).map(&:message).join "\n" end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby_speech-3.0.1-java | spec/support/matchers.rb |
ruby_speech-3.0.1 | spec/support/matchers.rb |
ruby_speech-3.0.0-java | spec/support/matchers.rb |
ruby_speech-3.0.0 | spec/support/matchers.rb |