Sha256: 26694d3af8ae9315a3643c5e6eb64865235cbb5a3673de471eaf00696efb2af8

Contents?: true

Size: 790 Bytes

Versions: 2

Compression:

Stored size: 790 Bytes

Contents

# @!method have_output_on_stdout
#   This matchers checks if <command> has created output on stdout
#
#   @return [Boolean] The result
#
#     false:
#     * if command has not created output on stdout
#     true:
#     * if command created output on stdout
#
#   @example Use matcher
#
#     RSpec.describe do
#       it { expect(last_command_started).to have_output_on_stdout }
#     end
RSpec::Matchers.define :have_output_on_stdout do |expected|
  match do |actual|
    @old_actual = actual

    raise "Expected #{@old_actual} to respond to #stdout" unless @old_actual.respond_to? :stdout

    @old_actual.stop

    @actual = sanitize_text(actual.stdout)

    values_match?(expected, @actual)
  end

  diffable

  description { "have output on stdout: #{description_of expected}" }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aruba-1.0.0 lib/aruba/matchers/command/have_output_on_stdout.rb
aruba-1.0.0.pre.alpha.5 lib/aruba/matchers/command/have_output_on_stdout.rb