Sha256: faa8f84e0812125bb11b9c36fd497c62296d3bace22761729b616982c487fd68

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the MIT license.

require File.expand_path('../../../../spec/helper', __FILE__)
require 'ramaze/helper/bench'

describe Ramaze::Helper::Bench do
  extend Ramaze::Helper::Bench

  log = []
  def log.info(arg); push(arg); end
  Ramaze::Log.loggers = [log]

  it 'logs running time' do
    result = bench{ sleep 0.1; 'result' }
    result.should == 'result'
    log.size.should == 1
    # output between ruby 1.8 and 1.9 differs...
    log.pop.should =~ %r!^Bench #{__FILE__}:#{__LINE__ - 4}:.* \d\.\d+$!
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-2023.01.06 spec/ramaze/helper/bench.rb
ramaze-2012.12.08 spec/ramaze/helper/bench.rb
ramaze-2012.12.08b spec/ramaze/helper/bench.rb
ramaze-2012.04.14 spec/ramaze/helper/bench.rb
ramaze-2012.03.07 spec/ramaze/helper/bench.rb