Class: RSpec::Support::StdErrSplitter

### Home Classes Methods

### In Files

- lib/rspec/support/spec/stderr_splitter.rb

### Parent

Object

### Methods

- ::new
- #==
- #has_output?
- #method_missing
- #output
- #reopen
- #reset!
- #to_io
- #verify_no_warnings!
- #write

### Class/Module Index

Quicksearch

- RSpec
- RSpec::CallerFilter
- RSpec::Support
- RSpec::Support::BlockSignature
- RSpec::Support::Differ
- RSpec::Support::DirectoryMaker
- RSpec::Support::EncodedString
- RSpec::Support::FormattingSupport
- RSpec::Support::FuzzyMatcher
- RSpec::Support::HunkGenerator
- RSpec::Support::InSubProcess
- RSpec::Support::LooseSignatureVerifier
- RSpec::Support::LooseSignatureVerifier::SignatureWithKeywordArgumentsMatcher
- RSpec::Support::MethodSignature
- RSpec::Support::MethodSignatureVerifier
- RSpec::Support::OS
- RSpec::Support::ObjectFormatter
- RSpec::Support::RecursiveConstMethods
- RSpec::Support::Ruby
- RSpec::Support::RubyFeatures
- RSpec::Support::ShellOut
- RSpec::Support::Spec
- RSpec::Support::StdErrSplitter
- RSpec::Support::StrictSignatureVerifier
- RSpec::Support::Version
- RSpec::Support::VersionChecker
- RSpec::Support::Warnings
- RSpec::Support::WithIsolatedStdErr
- Object
- RSpecHelpers

No matching classes.

# RSpec::Support::StdErrSplitter

### Public Class Methods

new(original) click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 6
    def initialize(original)
      @orig_stderr    = original
      @output_tracker = ::StringIO.new
    end

### Public Instance Methods

==(other) click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 21
    def ==(other)
      @orig_stderr == other
    end

has_output?() click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 45
    def has_output?
      !output.empty?
    end

method_missing(name, *args, &block) click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 16
    def method_missing(name, *args, &block)
      @output_tracker.__send__(name, *args, &block) if @output_tracker.respond_to?(name)
      @orig_stderr.__send__(name, *args, &block)
    end

output() click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 58
    def output
      @output_tracker.string
    end

reopen(*args) click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 25
    def reopen(*args)
      reset!
      @orig_stderr.reopen(*args)
    end

reset!() click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 49
    def reset!
      @output_tracker = ::StringIO.new
    end

to_io() click to toggle source

To work around JRuby error: can't convert RSpec::Support::StdErrSplitter into String

    # File lib/rspec/support/spec/stderr_splitter.rb, line 32
    def to_io
      @orig_stderr.to_io
    end

verify_no_warnings!() click to toggle source

    # File lib/rspec/support/spec/stderr_splitter.rb, line 53
    def verify_no_warnings!
      raise "Warnings were generated: #{output}" if has_output?
      reset!
    end

write(line) click to toggle source

To work around JRuby error: TypeError: $stderr must have write method, RSpec::StdErrSplitter given

    # File lib/rspec/support/spec/stderr_splitter.rb, line 38
    def write(line)
      return if line =~ %{^\S+/gems/\S+:\d+: warning:} # http://rubular.com/r/kqeUIZOfPG

      @orig_stderr.write(line)
      @output_tracker.write(line)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.