Sha256: ab51eb2086aa1438b5d17b514401b52d5c5cd1bce46ce6a5d4967165f14adf45

Contents?: true

Size: 804 Bytes

Versions: 14

Compression:

Stored size: 804 Bytes

Contents

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

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

    @old_actual.stop

    @actual = sanitize_text(actual.stderr)

    values_match?(expected, @actual)
  end

  diffable

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

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/command/have_output_on_stderr.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/aruba-2.2.0/lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-2.2.0 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-2.1.0 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-2.0.1 lib/aruba/matchers/command/have_output_on_stderr.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/aruba-2.0.0/lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-2.0.0 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.1.2 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.1.1 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.1.0 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.0.4 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.0.3 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.0.2 lib/aruba/matchers/command/have_output_on_stderr.rb
aruba-1.0.1 lib/aruba/matchers/command/have_output_on_stderr.rb