Sha256: e002caf45f192ec2bd591aa5a25745bd56ee53a8b6cbe8512f6c4b9b37776ebc
Contents?: true
Size: 821 Bytes
Versions: 9
Compression:
Stored size: 821 Bytes
Contents
module GenSpec module Matchers class OutputMatcher < GenSpec::Matchers::Base def output shell.output.string end def initialize(text_or_regexp) regexp = if text_or_regexp.kind_of?(Regexp) text_or_regexp else Regexp.compile(Regexp.escape(text_or_regexp), Regexp::MULTILINE) end @regexp = regexp super() silence_errors! end def generated match! if output =~ @regexp end def failure_message output + "\n" \ "expected to match #{@regexp.inspect}, but did not" end def negative_failure_message output + "\n" \ "expected not to match #{@regexp.inspect}, but did" end end end end
Version data entries
9 entries across 9 versions & 1 rubygems