Sha256: 9cbf99b68c54bac12fabfd80e11f77f480fd34df2b00f785f6e6c6e7da6cd026

Contents?: true

Size: 940 Bytes

Versions: 50

Compression:

Stored size: 940 Bytes

Contents

require 'test_helper'

module Vedeu

  describe Timer do

    let(:described) { Vedeu::Timer }
    let(:instance)  { described.new(_message) }
    let(:_message)  { 'Testing' }
    let(:_time)     { mock('Time') }
    let(:started)   { 1434492219.5238185 }

    before do
      Time.stubs(:now).returns(_time)
      _time.stubs(:to_f).returns(started)
    end

    describe '#initialize' do
      it { instance.must_be_instance_of(described) }
      it { instance.instance_variable_get('@message').must_equal(_message) }
      it { instance.instance_variable_get('@started').must_equal(started) }
    end

    describe '.timer' do
      it { described.must_respond_to(:timer) }
    end

    describe '#measure' do
      subject { instance.measure { } }

      it {
        Vedeu.expects(:log).with(type:    :timer,
                                 message: "Testing took 0.0ms.")
        subject
      }
    end

  end # Timer

end # Vedeu

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
vedeu-0.6.7 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.6 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.5 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.4 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.3 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.2 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.1 test/lib/vedeu/log/timer_test.rb
vedeu-0.6.0 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.13 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.12 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.11 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.10 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.9 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.8 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.7 test/lib/vedeu/log/timer_test.rb
vedeu-0.5.0 test/lib/vedeu/log/timer_test.rb
vedeu-0.4.65 test/lib/vedeu/timer_test.rb
vedeu-0.4.64 test/lib/vedeu/timer_test.rb
vedeu-0.4.63 test/lib/vedeu/timer_test.rb
vedeu-0.4.62 test/lib/vedeu/timer_test.rb