Sha256: 9b8246a5ce5331ed0ef81d281363db571d4329d6e736dc0b14e2a0f0ae6966d2

Contents?: true

Size: 524 Bytes

Versions: 1

Compression:

Stored size: 524 Bytes

Contents

# frozen_string_literal: true

module Lino
  module Executors
    class Mock
      attr_reader :calls
      attr_accessor :exit_code

      def initialize
        reset
      end

      def execute(command_line, opts = {})
        @calls << { command_line:, opts:, exit_code: @exit_code }

        return if @exit_code.zero?

        raise Lino::Errors::ExecutionError.new(
          command_line.string, @exit_code
        )
      end

      def reset
        @calls = []
        @exit_code = 0
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lino-3.2.0.pre.7 lib/lino/executors/mock.rb