spec/jtl_spec.rb in jtl-0.1.4 vs spec/jtl_spec.rb in jtl-0.1.5
- old
+ new
@@ -231,12 +231,24 @@
it 'to_gruff_labels' do
jtl = Jtl.new(jtl_path).flatten
expect(jtl.elapseds.frequencies(10).keys.to_gruff_labels).to eq({0=>"140", 1=>"150", 2=>"160", 3=>"170", 4=>"180", 5=>"190", 6=>"200", 7=>"210", 8=>"220", 9=>"230", 10=>"240", 11=>"250", 12=>"260", 13=>"270", 14=>"280", 15=>"290", 16=>"300", 17=>"310", 18=>"320", 19=>"330", 20=>"340", 21=>"350", 22=>"360", 23=>"370", 24=>"380", 25=>"390", 26=>"400", 27=>"410", 28=>"420", 29=>"430", 30=>"440", 31=>"450"})
end
+
it 'to_gruff_labels (pass block)' do
jtl = Jtl.new(jtl_path).flatten
labels = jtl.elapseds.frequencies(10).keys.to_gruff_labels {|k, v| (v % 100).zero? }
expect(labels).to eq({6=>"200", 16=>"300", 26=>"400"})
end
+ it 'reset interval' do
+ jtl = Jtl.new(jtl_path, :interval => 1_000)
+ interval_1s = jtl.elapseds.to_a
+
+ jtl.interval = 10_000
+ interval_10s = jtl.elapseds.to_a
+
+ expect(interval_1s.length).to eq(61)
+ expect(interval_10s.length).to eq(7)
+ expect(interval_1s.flatten.sort).to eq(interval_10s.flatten.sort)
+ end
end