Sha256: 3046d38182b62c0f6caa7dedfefafb574bdd85e75a6fb3f3a892dd8634806637

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

module Raph
  module Parser
    describe AssignmentParser do
      describe '#id' do
        it 'has correct form' do
          expect(subject.id).to eq :assignments
        end
      end

      describe '#parse' do
        it 'returns assignments only' do
          expect(subject.parse(['-h', '-on=20', '--two=my-file'])).
            to match_array(['-on=20', '--two=my-file'])
        end

        it 'has no to return assignments here' do
          expect(subject.parse(['-h', 'file', '=', '123'])).
            to match_array([])
          expect(subject.parse([])).to match_array([])
        end
      end

      describe '#assignment?' do
        def ass?(option)
          subject.assignment? option
        end

        it 'is an assignment' do
          expect(ass? 'h=one').to be true
          expect(ass? '-ass=two').to be true
          expect(ass? '--ass=two').to be true
          expect(ass? 'ass=one=two').to be true
        end

        it 'is not as assignment' do
          expect(ass? '-h').to be false
          expect(ass? '-h=').to be false
          expect(ass? 'h=').to be false
          expect(ass? '=').to be false
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
raph-0.0.1 spec/raph/parser/assinment_parser_spec.rb