Sha256: bf31015d5107b43dd4a8094f2f3b61b055c2fc15295394b82ad99de0986a11c4

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

include Rosette::Core

describe ExtractorId do
  module ExtractorsNoNaming
    module Foo
      class Bar; end
    end
  end

  module ExtractorsOneLevel
    module Foo
      class BarExtractor; end
    end
  end

  module ExtractorsTwoLevels
    module FooExtractor
      class BarExtractor; end
    end
  end

  let(:id) { ExtractorId }

  describe '#resolve' do
    it 'resolves constants with no modified naming' do
      expect(id.resolve('foo/bar', ExtractorsNoNaming)).to(
        be(ExtractorsNoNaming::Foo::Bar)
      )
    end

    it 'resolves constants with one level of naming' do
      expect(id.resolve('foo/bar', ExtractorsOneLevel)).to(
        be(ExtractorsOneLevel::Foo::BarExtractor)
      )
    end

    it 'resolves constants with two levels of naming' do
      expect(id.resolve('foo/bar', ExtractorsTwoLevels)).to(
        be(ExtractorsTwoLevels::FooExtractor::BarExtractor)
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 spec/core/resolvers/extractor_id_spec.rb