class Sus::HaveDuration
def call(assertions, subject)
def call(assertions, subject) assertions.nested(self) do |assertions| Expect.new(assertions, measure(subject)).to(@predicate) end end
def initialize(predicate)
def initialize(predicate) @predicate = predicate end
def measure(subject)
def measure(subject) start_time = now subject.call return now - start_time end
def now
def now ::Process.clock_gettime(Process::CLOCK_MONOTONIC) end
def print(output)
def print(output) output.write("have duration ") @predicate.print(output) end