Sha256: 4d95cfe81edebae22427a4d236be4ba3d70cd633748d10ce1a95c8b550a90c1d

Contents?: true

Size: 946 Bytes

Versions: 13

Compression:

Stored size: 946 Bytes

Contents

require_relative '../spec_helper'

describe Cranium::Logging do

  let(:logging_object) { Object.new.tap { |object| object.extend Cranium::Logging } }
  let(:loggers) { [double("Logger 1"), double("Logger 2")] }

  before(:each) do
    allow(Cranium).to receive_message_chain(:configuration, :loggers).and_return loggers
  end



  def all_loggers_should_receive(level, message)
    loggers.each { |logger| expect(logger).to receive(level).with(message) }
  end



  describe "#record_metric" do
    it "should record an arbitrary metric in every registered logger" do
      all_loggers_should_receive :info, "[metrics/products] 1234"

      logging_object.record_metric "products", 1234
    end
  end


  describe "#log" do
    it "should log a message with the specified reporting level in every registered logger" do
      all_loggers_should_receive :error, "error message"

      logging_object.log :error, "error message"
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cranium-0.8.1 spec/cranium/logging_spec.rb
cranium-0.8 spec/cranium/logging_spec.rb
cranium-0.7 spec/cranium/logging_spec.rb
cranium-0.6.1 spec/cranium/logging_spec.rb
cranium-0.5 spec/cranium/logging_spec.rb
cranium-0.4.3 spec/cranium/logging_spec.rb
cranium-0.4.2 spec/cranium/logging_spec.rb
cranium-0.4.1 spec/cranium/logging_spec.rb
cranium-0.4 spec/cranium/logging_spec.rb
cranium-0.3.1 spec/cranium/logging_spec.rb
cranium-0.3.0 spec/cranium/logging_spec.rb
cranium-0.2.1 spec/cranium/logging_spec.rb
cranium-0.2.0 spec/cranium/logging_spec.rb