spec/spec_helper.rb in eye-0.1.11 vs spec/spec_helper.rb in eye-0.2
- old
+ new
@@ -1,6 +1,5 @@
-# -*- encoding : utf-8 -*-
require 'rubygems'
require "bundler/setup"
require 'celluloid'
if ENV['COV']
@@ -36,10 +35,12 @@
$logger = Eye::Logger.new("spec")
Celluloid.logger = $logger
STDERR.reopen($logger_path)
+$logger.info "specs started in process #{$$}"
+
RSpec.configure do |config|
config.mock_with :rr
config.before(:all) do
silence_warnings{ Eye::SystemResources::PsAxActor::UPDATE_INTERVAL = 2 }
@@ -115,6 +116,12 @@
args.each do |a|
result.merge!(a)
end
result
-end
\ No newline at end of file
+end
+
+def should_spend(timeout = 0, delta = 0.05, &block)
+ tm1 = Time.now
+ yield
+ (Time.now - tm1).should be_within(delta).of(timeout)
+end