Sha256: 3923b87eed1cd9e6e6247c146036ca9a0d186daf37379ad61d26a0ccdbd72aa3

Contents?: true

Size: 600 Bytes

Versions: 9

Compression:

Stored size: 600 Bytes

Contents

require 'spec_helper'
require 'rom/memory'

require 'logger'

describe 'Repositories / Setting logger' do
  let(:logger_class) do
    Class.new do
      attr_reader :messages

      def initialize
        @messages = []
      end

      def info(msg)
        @messages << msg
      end
    end
  end

  let(:logger) do
    logger_class.new
  end

  it 'sets up a logger for a given repository' do
    setup = ROM.setup(:memory)

    setup.default.use_logger(logger)

    rom = setup.finalize

    rom.repositories[:default].logger.info("test")

    expect(logger.messages).to eql(["test"])
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rom-0.7.1 spec/integration/repositories/setting_logger_spec.rb
rom-0.7.0 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.2 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.1 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.0 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.0.rc1 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.0.beta3 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.0.beta2 spec/integration/repositories/setting_logger_spec.rb
rom-0.6.0.beta1 spec/integration/repositories/setting_logger_spec.rb