test/functional/storage_helper.rb in ruote-2.1.11 vs test/functional/storage_helper.rb in ruote-2.2.0

- old
+ new

@@ -11,14 +11,14 @@ def locate_storage_impl (arg) pers = arg[2..-1] - path = File.expand_path( - File.join(File.dirname(__FILE__), %w[ .. .. .. ], "ruote-#{pers}")) + path = Dir[File.expand_path( + File.join(File.dirname(__FILE__), %w[ .. .. .. ], "ruote-#{pers}*"))].first - (File.exist?(path) && File.directory?(path)) ? [ pers, path ] : nil + File.directory?(path) ? [ pers, path ] : nil end # # Returns the class of the engine to use, based on the ARGV # @@ -35,11 +35,11 @@ } exit 0 end - ps = ARGV.select { |a| a.match(/^--/) } + ps = ARGV.select { |a| a.match(/^--[a-z]/) } ps.delete('--split') persistent = opts.delete(:persistent) if ps.include?('--fs') @@ -54,28 +54,30 @@ Ruote::FsStorage.new('work', opts) elsif not ps.empty? pers = nil - ps.each do |a| - pers = locate_storage_impl(a) - break if pers - end + ps.find { |a| pers = locate_storage_impl(a) } raise "no persistence found (#{ps.inspect})" unless pers lib, path = pers $:.unshift(File.join(path, 'lib')) begin - load File.join(path, %w[ test functional_connection.rb ]) + load 'test/functional_connection.rb' rescue LoadError => le begin - load File.join(path, %w[ test integration_connection.rb ]) + load File.join(path, %w[ test functional_connection.rb ]) rescue LoadError => lee - p le - p lee - raise lee + begin + load File.join(path, %w[ test integration_connection.rb ]) + rescue LoadError => leee + p le + p lee + p leee + raise leee + end end end new_storage(opts)