Sha256: 08d7d21f4ed8229d51dfe38cd887da2e7dfca0555a223a5029c12d54a74e4368

Contents?: true

Size: 755 Bytes

Versions: 7

Compression:

Stored size: 755 Bytes

Contents

require 'spec_helper'

module Mdoc
  class Processor
    class TestProcessor; end
  end

  class Writer
    class DefaultPrinter; end
  end
end

describe Mdoc do
  describe '.get_class' do
    context 'test_processor for default module' do
      it 'get TestProcessor' do
        klass = Mdoc.get_class('test_processor')
        klass.should eq(Mdoc::Processor::TestProcessor)
      end
    end

    context 'default_printer for writer module' do
      it 'get DefaultPrinter' do
        klass = Mdoc.get_class('default_printer', Mdoc::Writer)
        klass.should eq(Mdoc::Writer::DefaultPrinter)
      end
    end

    context 'non-exists class' do
      it 'return nil' do
        Mdoc.get_class('not_exists').should be_nil
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mdoc-0.0.11 spec/get_class_spec.rb
mdoc-0.0.10 spec/get_class_spec.rb
mdoc-0.0.9 spec/get_class_spec.rb
mdoc-0.0.8 spec/get_class_spec.rb
mdoc-0.0.7 spec/get_class_spec.rb
mdoc-0.0.6 spec/get_class_spec.rb
mdoc-0.0.5 spec/get_class_spec.rb