spec/includes.rb in cross-stub-0.2.0 vs spec/includes.rb in cross-stub-0.2.1
- old
+ new
@@ -8,24 +8,28 @@
RUBY_VERSION.gsub(/[^\d]/,''),
RUBY_PLATFORM =~ /java/i ? 'j' : '',
RUBY_DESCRIPTION =~ /enterprise/i ? 'e' : ''
].join
-PROJECT_ROOT = File.join(File.dirname(__FILE__), '..')
+PROJECT_ROOT = File.join(File.dirname(File.expand_path(__FILE__)), '..')
PROJECT_FILE = lambda{|*args| File.join(*[PROJECT_ROOT, *args]) }
CACHE_STORES = {
:file => PROJECT_FILE['tmp', "stubbing-#{RUBY_VM}.cache"],
:memcache => "localhost:11211/stubbing-#{RUBY_VM}.cache",
:redis => "localhost:6379/stubbing-#{RUBY_VM}.cache",
}
-ECHO_SERVER_INIT_WAIT_TIME = RUBY_VM.end_with?('j') ? 10 : 2
-ECHO_SERVER_LOG = PROJECT_FILE['tmp', "echoserver-#{RUBY_VM}.log"]
-ECHO_SERVER_HOST = '127.0.0.1'
-ECHO_SERVER_PORT = 10000 + RUBY_VM[/(\d+)/,1].to_i + ({'j' => 7, 'e' => 17}[RUBY_VM[-1..-1]] || 0)
+# /////////////////////////////////////////////////////////////////////////////////////////
+# Configuring otaku service
+# /////////////////////////////////////////////////////////////////////////////////////////
+require 'otaku' unless Object.const_defined?('Otaku')
+Otaku.configure do |config|
+ config.log_file = PROJECT_FILE['tmp', "otaku-#{RUBY_VM}.log"]
+end
+
# /////////////////////////////////////////////////////////////////////////////////////////
# Useful methods
# /////////////////////////////////////////////////////////////////////////////////////////
def cache_store(id)
@@ -49,10 +53,10 @@
is_instance = klass_descriptor.end_with?(suffix = '#new')
[klassify(klass_descriptor), is_instance, method, args]
end
def do_remote_method_call(store_type_and_klass_and_method_and_args)
- (value = EchoClient.get(store_type_and_klass_and_method_and_args)) !~ /^undefined method/ ?
+ (value = Otaku.process(store_type_and_klass_and_method_and_args)) !~ /^undefined method/ ?
value : Object.we_just_wanna_trigger_no_method_error_with_this_weird_method!
end
def klassify(descriptor)
descriptor.sub('#new','').split(/::/).inject(Object){|k,c| k.const_get(c) }