Sha256: 3991f1ceac50e3a836e9663d6062f736c4d5ae63ae4730e1aefb02f9dfcdd267

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 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

1 entries across 1 versions & 1 rubygems

Version Path
raph-0.0.2 spec/raph/parser/base_parser_spec.rb