module RSpec::DescribeExecutable::Stream

Expectations regarding streams, i.e. stderr, stdout. Meant to be extended in describe_stderr and describe_stdout

Public Instance Methods

has_line(*lines)
has_line_matching(pat)
has_lines(*lines)
has_no_line(*lines)
has_no_line_matching(pat)
it_is_expected_not_to_have_line(*lines) click to toggle source

Expects lines in the specified stream not to include each of the specified lines @param [Regex, String] lines @see it_is_expected_to_have_line

# File lib/rspec/launchbox/describe_executable.rb, line 44
def it_is_expected_not_to_have_line(*lines)
  it "is expected not to have line(s) matching '#{lines}'" do
    expect(_watch_stream.lines.map(&:chomp)).not_to include *lines
  end
end
it_is_expected_not_to_have_lines(*lines)
it_is_expected_not_to_have_lines_matching(pat) click to toggle source

Expects *none of* the lines in the specified stream to match specified pattern @param [Regex, String] lines @see it_is_expected_to_have_line

# File lib/rspec/launchbox/describe_executable.rb, line 57
def it_is_expected_not_to_have_lines_matching(pat)
  it "is expected not to have line(s) matching pattern '#{pat}'" do
    __grep = _watch_stream.lines.grep(pat)
    expect(__grep.size).to be 0
  end
end
Also aliased as: has_no_line_matching
it_is_expected_to_have_line(*lines) click to toggle source

Expects lines in the specified stream to include each of the specified lines @param [Array] lines @example

describe_stderr do
  it_is_expected_to_have_line 'cannot load shared library'
end
# File lib/rspec/launchbox/describe_executable.rb, line 17
def it_is_expected_to_have_line(*lines)
  it "is expected to have line(s) matching '#{lines}'" do
    expect(_watch_stream.lines.map(&:chomp)).to include *lines
  end
end
it_is_expected_to_have_lines(*lines)
Also aliased as: has_line
it_is_expected_to_have_lines_matching(pat) click to toggle source

Expects some lines in the specified stream to match specified pattern @param [Regex, String] lines @see it_is_expected_to_have_line

# File lib/rspec/launchbox/describe_executable.rb, line 31
def it_is_expected_to_have_lines_matching(pat)
  it "is expected to have line(s) matching pattern '#{pat}'" do
    __grep = _watch_stream.lines.grep(pat)
    expect(__grep.size).to be > 0
  end
end
Also aliased as: has_line_matching