Sha256: f173049d632e6c2a526de181bd4bcc2c0285561e4c9b7436798c92f8a0412a4f

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

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_source) do
        <<~OUTPUT
          A stub runner.

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

          Options:
            -h --help    Show help.
        OUTPUT
      end
      let(:expected_output) do
        expected_output_source.gsub('__PROGRAM__', instance.program_name)
      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

19 entries across 19 versions & 1 rubygems

Version Path
eac_tools-0.76.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.75.2 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.75.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.75.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.74.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.74.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.73.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.72.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.70.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.70.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.69.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.69.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.68.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.67.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.67.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.66.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.65.1 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.65.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
eac_tools-0.64.0 sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb