Sha256: d62dcf9800133716834e07504ddeae084ce1c44c95615cfd891f7a4ee2994eee

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

module Raph
  module Parser
    describe BaseParser do
      describe '#id' do
        it 'returns correct value for base class' do
          expect(subject.id).to eql :bases
        end

        it 'returns correct value for child class' do
          class BaseArgumentParser < BaseParser; end
          expect(BaseArgumentParser.new.id).to eql :base_arguments
        end

        it 'returns correct value for modulized class' do
          module A
            module B
              class TestParser < BaseParser; end
            end
          end
          expect(A::B::TestParser.new.id).to eql :tests
        end

        it 'is correct when no name convention' do
          class Plural < BaseParser; end
          expect(Plural.new.id).to eql :plurals
        end

        it 'can be redefined' do
          class Plural < BaseParser
            def id
              :tests
            end
          end
          expect(Plural.new.id).to eql :tests
        end
      end

      describe '#parse' do
        it 'returns args' do
          expect(subject.parse [1, 2, 3]).to be nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
raph-0.0.3 spec/raph/parser/base_parser_spec.rb
raph-0.0.1 spec/raph/parser/base_parser_spec.rb