Sha256: 35dbd138bb577f8bd1d2afbf501d83693fc56879a12b64d059b66cdbf02886ef

Contents?: true

Size: 802 Bytes

Versions: 8

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/docopt/runner_extension'

RSpec.describe ::EacCli::Docopt::RunnerExtension do
  let(:stub_runner) do
    r = Class.new(::EacCli::DocoptRunner) do
      def run; end
    end
    r.include ::EacCli::Runner
    r.runner_definition do
      desc 'A stub runner.'
      arg_opt '-o', '--opt1', 'A argument option'
      pos_arg 'pos1'
    end
    r
  end

  let(:instance) { stub_runner.new(argv: %w[-o aaa bbb]) }

  before { instance.run }

  it { expect(instance.options.fetch('--opt1')).to eq('aaa') }
  it { expect(instance.options.fetch('<pos1>')).to eq('bbb') }
  it { expect(instance.doc).to eq(<<~EXPECTED) }
    A stub runner.

    Usage:
      __PROGRAM__ [options] <pos1>

    Options:
      -o --opt1=<value>    A argument option

  EXPECTED
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
avm-tools-0.102.2 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.102.1 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.102.0 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.101.0 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.100.0 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
ehbrs-tools-0.21.0 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.99.1 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
avm-tools-0.99.0 vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb