./test/helper.rb in fun_with_files-0.0.9 vs ./test/helper.rb in fun_with_files-0.0.12

- old
+ new

@@ -1,8 +1,5 @@ -# require 'rubygems' -# require 'bundler' -# require 'debugger' require 'fun_with_testing' # begin # Bundler.setup(:default, :development) @@ -33,12 +30,25 @@ yield end end def empty_temp_directory - tmp = FunWith::Files.root("test", "tmp") + tmp = FunWith::Files.root( "test", "tmp" ) tmp.empty! assert_directory tmp puts tmp.glob(:all) assert_empty_directory tmp + end + + def if_internet_works( &block ) + `ping -c 1 google.com 2>&1 >> /dev/null` # TODO: Portability issue + connection_detected = $?.success? + + if block_given? + if connection_detected # TODO: How to tell difference between "no internet" and "no ping utility?" + yield + else + puts "No internet connection. Skipping." + end + end end end \ No newline at end of file