Exception: StderrAssay
- Inherits:
-
OutputAssay
- Object
- Exception
- Assertion
- OutputAssay
- StderrAssay
- Defined in:
- lib/assay/stderr_assay.rb
Overview
Assert that there is output $stderr.
StderrAssay.pass?(/foo/){ $stderr.puts 'foo!' } #=> true
Constant Summary
Constants inherited from Assertion
Constants included from Assay::Assertable
Class Method Summary collapse
-
.pass?(match, &block) ⇒ Boolean
Check assertion via ‘#===` method.
Methods inherited from Assertion
by_name, by_operator, inherited, register, subclasses
Methods included from Assay::Assertable
#[], #assert!, #assert_message, #assertive_name, #assertor, #fail?, #operator, #pass?, #refute!, #refute_message
Class Method Details
.pass?(match, &block) ⇒ Boolean
Check assertion via ‘#===` method.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/assay/stderr_assay.rb', line 14 def self.pass?(match, &block) require 'stringio' begin stderr = $stderr newerr = StringIO.new $stderr = newerr yield ensure $stderr = stderr end match === newerr.string.chomp("\n") end |