Sha256: d051b6606d0ff19a5369638156d8fca459578f918b0c1e2a9ee57a38f00e3784

Contents?: true

Size: 1001 Bytes

Versions: 1

Compression:

Stored size: 1001 Bytes

Contents

# encoding: UTF-8

require 'spec_helper'

include Rosette::Core

describe IntegrationId do
  module IntegrationsNoNaming
    module Foo
      class Bar; end
    end
  end

  module IntegrationsOneLevel
    module Foo
      class BarIntegration; end
    end
  end

  module IntegrationsTwoLevels
    module FooIntegration
      class BarIntegration; end
    end
  end

  let(:id) { IntegrationId }

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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