class StdoutAssay
Assert that there is output, either from stdout or stderr.
StdoutAssay.pass?(/foo/){ puts 'foo!' } #=> true
Public Class Methods
pass?(match) { || ... }
click to toggle source
Check assertion via ‘#===` method.
# File lib/assay/stdout_assay.rb, line 14 def self.pass?(match, &block) require 'stringio' begin stdout = $stdout newout = StringIO.new $stdout = newout yield ensure $stdout = stdout end match === newout.string.chomp("\n") end