# frozen_string_literal: true

RSpec.describe Aleph::Persistence::Utils::Klass do
  let(:klass) { described_class }

  describe '.symbolize' do
    it 'handles single word class' do
      Simple = Class.new

      expect(klass.symbolize(Simple)).to be(:simple)
    end

    it 'handles multiple word class' do
      MultipleWord = Class.new

      expect(klass.symbolize(MultipleWord)).to be(:multiple_word)
    end

    it 'handles nested class' do
      expect(klass.symbolize(Some::Nested::Path::NestedKlass)).to be(:nested_klass)
    end

    it 'handles class instances' do
      KlassInstance = Class.new

      expect(klass.symbolize(KlassInstance.new)).to be(:klass_instance)
    end
  end

  private

  module Some
    module Nested
      module Path
        class NestedKlass
        end
      end
    end
  end
end
