Sha256: 714ef2ef5baf5af218932a0c0702bf789ea8d825bc3cd30af853b3df560d41a0

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

require 'spec_helper'
module Viiite
  describe Benchmark, '.new' do

    subject{ Benchmark.new(arg) }

    after{
      subject.to_a.size.should eq(1)
      subject.to_a.first.keys.sort_by(&:to_s).should eq([:bench, :tms])
    }

    describe 'with a Proc' do
      let(:arg){ lambda{|b| b.report(:add){ 1+1 } } }
      it{ should be_a(Benchmark) }
    end

    describe 'with an existing file' do
      let(:arg){ File.expand_path('../bench_add.rb', __FILE__) }
      it{ should be_a(Benchmark) }
    end

    describe 'with an IO' do
      let(:arg){ File.open(File.expand_path('../bench_add.rb', __FILE__), 'r') }
      it{ should be_a(Benchmark) }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
viiite-0.2.0 spec/unit/benchmark/test_new.rb