Sha256: 0587fef6c92e6e7039f412acb35e22a09c8b9882b583cedc81d546475aab5be4

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

module DSL
  def expect_exit(value)
    @result.alterations = "Read exit code"
    real_value = result.exitcode
    cond = if value.is_a? Range
      expect_value = "With range #{value}"
      value.to_a.include? real_value
    elsif value.is_a? Array
      expect_value = "Inside list #{value}"
      value.include? real_value
    else
      expect_value = value
      (real_value == value.to_i)
    end
    expect2 cond, value: real_value, expected: expect_value
  end

  def expect_fail
    @result.alterations = "Read exit code"
    real_value = result.exitcode
    expect_value = "Greater than 0"
    cond = (real_value > 0)
    expect2 cond, value: real_value, expected: expect_value
  end

  def expect_ok
    expect_exit 0
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teuton-2.9.2 lib/teuton/case/dsl/expect_exitcode.rb
teuton-2.9.1 lib/teuton/case/dsl/expect_exitcode.rb
teuton-2.9.0 lib/teuton/case/dsl/expect_exitcode.rb