Sha256: fb16cb08fadd880705aa5ac69c61c1b8a98a5dd8c364ded360eb22f3a1666bbf

Contents?: true

Size: 572 Bytes

Versions: 7

Compression:

Stored size: 572 Bytes

Contents

require "mothership"

module MothershipHelpers
  def command(inputs = {})
    cmd = Mothership::Command.new(Mothership)

    inputs.each do |name, opts|
      cmd.add_input(name, opts)
    end

    if block_given?
      yield cmd
    else
      cmd
    end
  end

  def inputs(cmd, *argv)
    input_hash = {}
    given = Mothership::Parser.new(cmd).parse_argv(argv)
    inputs = Mothership::Inputs.new(cmd, nil, {}, given)
    given.each_key do |k|
      input_hash[k] = inputs[k]
    end
    input_hash
  end
end

RSpec.configure do |c|
  c.include MothershipHelpers
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mothership-0.5.1 spec/spec_helper.rb
mothership-0.5.0 spec/spec_helper.rb
mothership-0.4.0 spec/spec_helper.rb
mothership-0.3.5 spec/spec_helper.rb
mothership-0.3.4 spec/spec_helper.rb
mothership-0.3.3 spec/spec_helper.rb
mothership-0.3.2 spec/spec_helper.rb