examples/skeleton/spec/spec_helper.rb in win32-autogui-0.3.0 vs examples/skeleton/spec/spec_helper.rb in win32-autogui-0.4.0
- old
+ new
@@ -8,18 +8,25 @@
require 'myapp'
require 'spec'
require 'spec/autorun'
require 'aruba/api'
-# aruba helper, returns full path to files in the aruba tmp folder
+# aruba helpers
+#
+# @return full path to files in the aruba tmp folder
def fullpath(filename)
path = File.expand_path(File.join(current_dir, filename))
- path = `cygpath -w #{path}`.chomp if path.match(/^\/cygdrive/) # cygwin?
+ if path.match(/^\/cygdrive/)
+ # match /cygdrive/c/path/to and return c:\\path\\to
+ path = `cygpath -w #{path}`.chomp
+ elsif path.match(/.\:/)
+ # match c:/path/to and return c:\\path\\to
+ path = path.gsub(/\//, '\\')
+ end
path
end
-
-# return the contents of "filename" in the aruba tmp folder
-def get_file_content(filename)
+# @return the contents of "filename" in the aruba tmp folder
+def get_file_contents(filename)
in_current_dir do
IO.read(filename)
end
end