Sha256: 251a8a8efcce0465d800b50b1351b94f72eb161dc5556729205c2e0b214c1542

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

describe Nanoc::Telemetry do
  subject { described_class.new }

  example do
    expect(subject.counter(:filters).values).to eq({})
    expect(subject.counter(:filters).get(:erb).value).to eq(0)
    expect(subject.counter(:filters).value(:erb)).to eq(0)

    subject.counter(:filters).increment(:erb)
    expect(subject.counter(:filters).values).to eq(erb: 1)
    expect(subject.counter(:filters).get(:erb).value).to eq(1)
    expect(subject.counter(:filters).value(:erb)).to eq(1)
  end

  example do
    subject.summary(:filters).observe(0.1, :erb)
    expect(subject.summary(:filters).quantile(0.0, :erb)).to be_within(0.00001).of(0.1)
    expect(subject.summary(:filters).quantile(0.5, :erb)).to be_within(0.00001).of(0.1)
    expect(subject.summary(:filters).quantile(1.0, :erb)).to be_within(0.00001).of(0.1)

    subject.summary(:filters).observe(1.1, :erb)
    expect(subject.summary(:filters).quantile(0.0, :erb)).to be_within(0.00001).of(0.1)
    expect(subject.summary(:filters).quantile(0.5, :erb)).to be_within(0.00001).of(0.6)
    expect(subject.summary(:filters).quantile(1.0, :erb)).to be_within(0.00001).of(1.1)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nanoc-4.7.9 spec/nanoc/telemetry_spec.rb
nanoc-4.7.8 spec/nanoc/telemetry_spec.rb
nanoc-4.7.7 spec/nanoc/telemetry_spec.rb
nanoc-4.7.6 spec/nanoc/telemetry_spec.rb
nanoc-4.7.5 spec/nanoc/telemetry_spec.rb
nanoc-4.7.4 spec/nanoc/telemetry_spec.rb
nanoc-4.7.3 spec/nanoc/telemetry_spec.rb
nanoc-4.7.2 spec/nanoc/telemetry_spec.rb
nanoc-4.7.1 spec/nanoc/telemetry_spec.rb
nanoc-4.7.0 spec/nanoc/telemetry_spec.rb