Sha256: 51a0c347f70924c2d64c9892d9882f9bf33496139009815212cebb04a2567ceb
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
module Bench module Matchers class RunsIn #:nodoc: def initialize(receiver=nil, &block) @receiver = receiver # Placeholder end def matches?(event_proc) raise_block_syntax_error if block_given? @before = Time.now event_proc.call @after = Time.now @distance = @after - @before return @distance < @receiver end def failure_message duration = ActiveSupport::Duration.new(1, [[:seconds, @distance]]) "Expected call to run in #{@receiver.inspect}, actually ran in #{duration.inspect}." end end def run_in(receiver=nil, &block) Matchers::RunsIn.new(receiver, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spec-bench-0.0.0 | lib/bench/runs_in.rb |