From 2ddebdb2855f08cdb1135db555ee19317190d64b Mon Sep 17 00:00:00 2001 From: Luke Petre Date: Wed, 7 Apr 2010 15:53:17 +0100 Subject: [PATCH] * making benchmarks friendly to missing backends --- benchmarks.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/benchmarks.rb b/benchmarks.rb index e0e1614ae..04cee5a03 100644 --- a/benchmarks.rb +++ b/benchmarks.rb @@ -6,8 +6,20 @@ Delayed::Worker.logger = Logger.new('/dev/null') +BACKENDS = [] +Dir.glob("#{File.dirname(__FILE__)}/spec/setup/*.rb") do |backend| + begin + backend = File.basename(backend, '.rb') + require "spec/setup/#{backend}" + BACKENDS << backend.to_sym + rescue LoadError + puts "Unable to load #{backend} backend! #{$!}" + end +end + + Benchmark.bm(10) do |x| - [:active_record, :mongo_mapper, :data_mapper].each do |backend| + BACKENDS.each do |backend| require "spec/setup/#{backend}" Delayed::Worker.backend = backend