Sha256: 81fb0633dc3271b7697f9f11db2a5cf158785e2f160031cf08bcceda42408f4b

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

include Rosette::Core

describe PreprocessorId do
  module PreprocessorsNoNaming
    module Foo
      class Bar; end
    end
  end

  module PreprocessorsOneLevel
    module Foo
      class BarPreprocessor; end
    end
  end

  module PreprocessorsTwoLevels
    module FooPreprocessor
      class BarPreprocessor; end
    end
  end

  let(:id) { PreprocessorId }

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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