Sha256: f584b3faa428a44a5b04a0a6fe62e7654bdb717f8e6a4f3fd227588e52852f96
Contents?: true
Size: 637 Bytes
Versions: 8
Compression:
Stored size: 637 Bytes
Contents
# From http://stackoverflow.com/a/20583518/1668119 # modified to work with RSpec 3.0 RSpec::Matchers.define :match_stdout do |check| @capture = nil match do |block| begin stdout_saved = $stdout $stdout = StringIO.new block.call ensure @capture = $stdout $stdout = stdout_saved end @capture.string.match check end failure_message do "expected to #{description}" end failure_message_when_negated do "expected not to #{description}" end description do "match [#{check}] on stdout [#{@capture.string}]" end def supports_block_expectations? true end end
Version data entries
8 entries across 8 versions & 1 rubygems