Permalink
Browse files

ruby 1.8 fixes

  • Loading branch information...
1 parent 78ebdc3 commit 93893ec4c89ab2c3b03ce945114abc1318da30d8 @jarmo jarmo committed Mar 12, 2012
@@ -20,7 +20,7 @@ def sleep seconds
@sleep_time += Kernel.sleep seconds
end
def now
- Time.now
+ ::Time.now
end
end
@@ -95,4 +95,4 @@ def now
end
end
-end # module
+end # module
@@ -32,7 +32,7 @@ def add name, value, options={}
end
def delete name
- options = {:expires => Time.now - 60 * 60 * 24}
+ options = {:expires => ::Time.now - 60 * 60 * 24}
delete_with_options name, options
# make sure that the cookie gets deleted
@@ -411,11 +411,11 @@ def close
wait rescue nil
chwnd = @ie.hwnd.to_i
@ie.quit
- t = Time.now
+ t = ::Time.now
while exists?
# just in case to avoid possible endless loop if failing to close some
# window or tab
- break if Time.now - t > 10
+ break if ::Time.now - t > 10
sleep 0.3
end
end
@@ -519,7 +519,7 @@ def wait(no_sleep=false)
@xml_parser_doc = nil
@down_load_time = 0.0
interval = 0.05
- start_load_time = Time.now
+ start_load_time = ::Time.now
Timeout::timeout(5*60) do
begin
@@ -537,7 +537,7 @@ def wait(no_sleep=false)
documents_to_wait_for = [@ie.document]
rescue WIN32OLERuntimeError # IE window must have been closed
- @down_load_time = Time.now - start_load_time
+ @down_load_time = ::Time.now - start_load_time
return @down_load_time
end
@@ -558,7 +558,7 @@ def wait(no_sleep=false)
end
end
- @down_load_time = Time.now - start_load_time
+ @down_load_time = ::Time.now - start_load_time
run_error_checks
sleep @pause_after_wait unless no_sleep
@down_load_time
@@ -38,7 +38,7 @@ def execute_script(source)
document.parentWindow.eval(source.to_s)
rescue WIN32OLERuntimeError, NoMethodError #if eval fails we need to use execScript(source.to_s) which does not return a value, hence the workaround
escaped_src = source.to_s.gsub(/[\r\n']/) {|m| "\\#{m}"}
- wrapper = "_watir_helper_div_#{Time.now.to_i + Time.now.usec}"
+ wrapper = "_watir_helper_div_#{::Time.now.to_i + ::Time.now.usec}"
cmd = "var e = document.createElement('DIV'); e.style.display='none'; e.id='#{wrapper}'; e.innerHTML = eval('#{escaped_src}'); document.body.appendChild(e);"
document.parentWindow.execScript(cmd)
document.getElementById(wrapper).innerHTML
@@ -3,7 +3,7 @@ module Container
class << self
def support_element method_name, args={}
- klass = args[:class] || method_name.capitalize
+ klass = args[:class] || method_name.to_s.capitalize
super_class = args[:super_class] || "Element"
unless Watir.const_defined? klass

0 comments on commit 93893ec

Please sign in to comment.