Sha256: 9c7ff5f4b62bfa1a6ab151210cf92d2c7f74ce78f9c53f29716ac08609a981a8

Contents?: true

Size: 1.08 KB

Versions: 17

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe PulseMeter::Sensor::Timelined::MultiPercentile do
  it_should_behave_like "timeline sensor", {:p => [0.8]}
  it_should_behave_like "timelined subclass", [5, 4, 2, 2, 2, 2, 2, 2, 2, 1], {0.8 => 2, 0.5 => 2}.to_json, {:p => [0.8, 0.5]}
  it_should_behave_like "timelined subclass", [1], {0.8 => 1}.to_json, {:p => [0.8]}
  
  let(:init_values) {{:ttl => 1, :raw_data_ttl => 1, :interval => 1, :reduce_delay => 1}}
  let(:name) {"percentile"}

  it "should raise exception when extra parameter is not array of percentiles" do
    expect {described_class.new(name, init_values.merge({:p => :bad}))}.to raise_exception(ArgumentError) 
  end

  it "should raise exception when one of percentiles is not between 0 and 1" do
    expect {described_class.new(name, init_values.merge({:p => [0.5, -1]}))}.to raise_exception(ArgumentError) 
    expect {described_class.new(name, init_values.merge({:p => [0.5, 1.1]}))}.to raise_exception(ArgumentError) 
    expect {described_class.new(name, init_values.merge({:p => [0.5, 0.1]}))}.not_to raise_exception(ArgumentError) 
  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
pulse_meter_core-0.5.2 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse_meter_core-0.5.1 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse_meter_core-0.5.0 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse_meter_core-0.4.13 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.9 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.8 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.7 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.6 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.5 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.4 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.3 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.2 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.1 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.4.0 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.3.2 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.3.1 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb
pulse-meter-0.3.0 spec/pulse_meter/sensor/timelined/multi_percentile_spec.rb