Sha256: a15f9b6109ed530948aa89343e14caf5bf363dca5c0dbfedcd347fd8bfd425a7

Contents?: true

Size: 841 Bytes

Versions: 33

Compression:

Stored size: 841 Bytes

Contents

require "spec_helper"

describe Timber::Events::Custom, :rails_23 => true do
  describe ".to_hash" do
    it "should coerce type into an atom" do
      custom_event = described_class.new(:type => "my type", :message => "hello", :data => {:key => "value"})
      hash = custom_event.to_hash()
      expect(hash.keys.first).to eq(:"my type")
    end

    it "should coerce a Time into a float representing fractional milliseconds" do
      timer = Timber::Timer.start
      sleep(0.25)
      custom_event = described_class.new(:type => :my_event, :message => "hello", :data => {:time_ms => timer})
      expect(custom_event.message).to include("in ")
      expect(custom_event.message).to end_with("ms")
      data = custom_event.data
      expect(data[:time_ms]).to be_kind_of(Float)
      expect(data[:time_ms]).to be > 0.0
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
timber-2.6.1 spec/timber/events/custom_spec.rb
timber-2.6.0 spec/timber/events/custom_spec.rb
timber-2.6.0.pre.beta2 spec/timber/events/custom_spec.rb
timber-2.6.0.pre.beta1 spec/timber/events/custom_spec.rb
timber-2.5.1 spec/timber/events/custom_spec.rb
timber-2.5.0 spec/timber/events/custom_spec.rb
timber-2.4.0 spec/timber/events/custom_spec.rb
timber-2.3.4 spec/timber/events/custom_spec.rb
timber-2.3.3 spec/timber/events/custom_spec.rb
timber-2.3.2 spec/timber/events/custom_spec.rb
timber-2.3.1 spec/timber/events/custom_spec.rb
timber-2.3.0 spec/timber/events/custom_spec.rb
timber-2.2.3 spec/timber/events/custom_spec.rb
timber-2.2.2 spec/timber/events/custom_spec.rb
timber-2.2.1 spec/timber/events/custom_spec.rb
timber-2.2.0 spec/timber/events/custom_spec.rb
timber-2.1.10 spec/timber/events/custom_spec.rb
timber-2.1.9 spec/timber/events/custom_spec.rb
timber-2.1.8 spec/timber/events/custom_spec.rb
timber-2.1.7 spec/timber/events/custom_spec.rb