Sha256: 655428f8f1c39f345604808b2d15320461e18d1f1ed528951c6c67d01238b970

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

require 'spec_helper'
require 'anvil/task/options'

describe Anvil::Task::Options do
  let(:klass) { DummyTask }

  describe '.define_parser' do
    it 'returns an instance of Anvil::Parser' do
      expect(klass.define_parser).to be_kind_of(Anvil::Parser)
    end
  end

  describe '.parse_options!' do
    let(:klass) do
      Class.new(DummyTask) do
        parser do
          on('-i', '--install') do |i|
            options[:install] = i
          end
        end
      end
    end

    let(:arguments) { %w{arg1 arg2 --install} }

    let(:expected) do
      ['arg1', 'arg2', { install: true }]
    end
    it 'returns the correct arguments and options' do
      expect(klass.parse_options!(arguments)).to be_eql(expected)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
anvil-core-0.0.1.pre.alpha.3 spec/lib/anvil/task/options_spec.rb
anvil-core-0.0.1.pre.alpha.2 spec/lib/anvil/task/options_spec.rb
anvil-core-0.0.1.alpha.1 spec/lib/task/options_spec.rb