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.4.61 test/lib/vedeu/timer_test.rb
vedeu-0.4.60 test/lib/vedeu/timer_test.rb
vedeu-0.4.59 test/lib/vedeu/timer_test.rb
vedeu-0.4.58 test/lib/vedeu/timer_test.rb
vedeu-0.4.57 test/lib/vedeu/timer_test.rb
vedeu-0.4.56 test/lib/vedeu/timer_test.rb
vedeu-0.4.55 test/lib/vedeu/timer_test.rb
vedeu-0.4.54 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.53 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.52 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.51 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.50 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.49 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.48 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.47 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.46 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.45 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.44 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.43 test/lib/vedeu/support/timer_test.rb
vedeu-0.4.42 test/lib/vedeu/support/timer_test.rb