class RSpec::Matchers::BuiltIn::Output
Not intended to be instantiated directly.
Provides the implementation for ‘output`.
@api private
def actual_output_description
def actual_output_description return "nothing" unless captured? actual_formatted end
def captured?
def captured? @actual.length > 0 end
def description
-
(String)
-
Other tags:
- Api: - private
def description if @expected "output #{description_of @expected} to #{@stream_capturer.name}" else "output to #{@stream_capturer.name}" end end
def diffable?
-
(Boolean)
-
Other tags:
- Api: - private
def diffable? true end
def does_not_match?(block)
def does_not_match?(block) !matches?(block) && Proc === block end
def failure_message
-
(String)
-
Other tags:
- Api: - private
def failure_message "expected block to #{description}, but #{positive_failure_reason}" end
def failure_message_when_negated
-
(String)
-
Other tags:
- Api: - private
def failure_message_when_negated "expected block to not #{description}, but #{negative_failure_reason}" end
def initialize(expected)
def initialize(expected) @expected = expected @actual = "" @block = nil @stream_capturer = NullCapture end
def matches?(block)
def matches?(block) @block = block return false unless Proc === block @actual = @stream_capturer.capture(block) @expected ? values_match?(@expected, @actual) : captured? end
def negative_failure_reason
def negative_failure_reason return "was not a block" unless Proc === @block "output #{actual_output_description}" end
def positive_failure_reason
def positive_failure_reason return "was not a block" unless Proc === @block return "output #{actual_output_description}" if @expected "did not" end
def supports_block_expectations?
-
(True)
-
Other tags:
- Api: - private
def supports_block_expectations? true end
def supports_value_expectations?
-
(False)
-
Other tags:
- Api: - private
def supports_value_expectations? false end
def to_stderr
- Api: - public
def to_stderr @stream_capturer = CaptureStderr self end
def to_stderr_from_any_process
- Api: - public
def to_stderr_from_any_process @stream_capturer = CaptureStreamToTempfile.new("stderr", $stderr) self end
def to_stdout
- Api: - public
def to_stdout @stream_capturer = CaptureStdout self end
def to_stdout_from_any_process
- Api: - public
def to_stdout_from_any_process @stream_capturer = CaptureStreamToTempfile.new("stdout", $stdout) self end