File: initialize_spec.rb

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

require "spec_helper"

describe "Hitimes::Initialize" do
  it "should return a clock id" do
    val = Hitimes::Initialize.determine_clock_id
    _(val).wont_be_nil
  end

  it "should return :CLOCK_REALTIME as a last option" do
    val = Hitimes::Initialize.determine_clock_id([:CLOCK_REALTIME])
    _(val).must_equal(Process::CLOCK_REALTIME)
  end

  it "should raise an error if no clock id is found" do
    _(lambda {
        Hitimes::Initialize.determine_clock_id([])
      }).must_raise(Hitimes::Error, /Unable to find a high resolution clock/)
  end
end