File: timer_spec.rb

package info (click to toggle)
ruby-cucumber-core 16.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 764 kB
  • sloc: ruby: 5,074; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'cucumber/core/test/timer'
require 'support/duration_matcher'

describe Cucumber::Core::Test::Timer do
  let(:random_time) { 525_702_744_080_000 }
  let(:other_random_time) { 525_702_744_080_001 }

  before do
    allow(Cucumber::Core::Test::Timer::MonotonicTime).to receive(:time_in_nanoseconds).and_return(random_time, other_random_time)
  end

  it 'returns a Result::Duration object' do
    timer = described_class.new.start

    expect(timer.duration).to be_duration(1)
  end
end