test/abstract_unit.rb in luruju-0.1.0 vs test/abstract_unit.rb in luruju-0.2.0
- old
+ new
@@ -4,39 +4,53 @@
require 'luruju'
require 'fileutils'
class Test::Unit::TestCase
- java_class_path = java.lang.System.getProperty "java.class.path"
- jude_product = "community-5.0.2" if java_class_path.include? "Community"
- jude_product = "professional-5.1" if java_class_path.include? "Professional"
+ if am_i_jruby?
+ java_class_path = java.lang.System.getProperty "java.class.path"
+ jude_product = "community-5.0.2" if java_class_path.include? "Community"
+ jude_product = "professional-5.1" if java_class_path.include? "Professional"
+ else
+ jude_product = "community-5.0.2"
+ end
+
TEST_JUDE_DIR = File.dirname(__FILE__) + '/jude/' + jude_product
include Luruju
+ @@test_jude_model_dir = {}
+
+ def self.test_jude_model_dir(dir_sym) @@test_jude_model_dir[self] = dir_sym.to_s end
+
def setup
- # JudeApi.constants.each {|c| JudeApi.remove_const(c)}
+ Luruju::Configuration.install
end
+ def teardown
+ Luruju::Configuration.install
+ end
+
protected
- def jude_api_load jude_file
- jude_path = "#{TEST_JUDE_DIR}/#{@@test_jude_model_dir}/#{jude_file}.jude"
- FileUtils.cp jude_path, "c:/#{jude_file}.jude"
- Luruju::JudeApiLoader.load "c:/#{jude_file}.jude"
+ def jude_api_load jude_file, options={}
+ jude_path = "#{jude_dir}/#{jude_file}.jude"
+ Luruju::JudeApiLoader.load jude_path, options
end
- def self.test_jude_model_dir dir_sym
- @@test_jude_model_dir = dir_sym.to_s
+ def jude_dir()
+ if @@test_jude_model_dir[self.class]
+ "#{TEST_JUDE_DIR}/#{@@test_jude_model_dir[self.class]}"
+ else
+ File.dirname(__FILE__) + '/jude/'
+ end
end
end
-
class Object
def jude_methods
self.class.ancestors.inject(self.methods) do |result,item|
result -= item.methods unless item.parent == Luruju::JudeApi
result
end.sort
end
end
-