Sha256: 7b48083e2675978fd6bacac3dbdb2a4e18464f3262978b64c44c434185596863

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/runner_with/help'
require 'eac_ruby_utils/fs/temp'

RSpec.describe ::EacCli::RunnerWith::Help do
  let(:runner) do
    the_module = described_class
    Class.new do
      include the_module

      runner_definition do
        desc 'A stub runner.'
        pos_arg :a_argument
      end

      def run
        puts 'Runner run'
      end
    end
  end

  [
    ['--help'],
    ['trash-pos-arg-before', '--help', 'trash-pos-arg-after']
  ].each do |runner_argv|
    context "when runner ARGV is #{runner_argv}" do
      let(:instance) { runner.create(argv: runner_argv) }
      let(:expected_output) do
        <<~OUTPUT
          A stub runner.

          Usage:
            __PROGRAM__ [options] <a_argument>
            __PROGRAM__ --help

          Options:
            -h --help    Show help.

        OUTPUT
      end

      it 'show help text' do
        expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
avm-tools-0.117.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb