Sha256: d5176cbf24071d6d09c9b70d446fee540dae7ed11cf3765515201481e0ef41c7
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'minitest_helper' describe 'Summary' do let(:events) do [ SimpleProfiler::Event.new(Struct, :class, :run, [], Time.now, Time.now+1, 5, 10), SimpleProfiler::Event.new(Struct, :class, :run, [], Time.now, Time.now+1, 10, 15), SimpleProfiler::Event.new(Struct, :instance, :run, [], Time.now, Time.now+1, 15, 16) ] end it 'Accumulate events' do summary = SimpleProfiler::Reporters::Summary.new events.each do |event| summary.notify event end summary.events.must_equal events end it 'Ranking' do summary = SimpleProfiler::Reporters::Summary.new events.each do |event| summary.notify event end ranking = summary.ranking(sort_by: :hits) ranking.count.must_equal 2 ranking[0][:klass].must_equal 'Struct' ranking[0][:target].must_equal :class ranking[0][:method].must_equal :run ranking[0][:hits].must_equal 2 ranking[1][:klass].must_equal 'Struct' ranking[1][:target].must_equal :instance ranking[1][:method].must_equal :run ranking[1][:hits].must_equal 1 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_profiler-0.1.2 | spec/summary_spec.rb |
simple_profiler-0.1.1 | spec/summary_spec.rb |
simple_profiler-0.1.0 | spec/summary_spec.rb |