Sha256: 7e5eaf75053fb6f6a8b6d2fd5b059c7d22fed0f4868a75bcd99f6882f0a712e9

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require 'fun_with_testing'


# begin
#   Bundler.setup(:default, :development)
# rescue Bundler::BundlerError => e
#   $stderr.puts e.message
#   $stderr.puts "Run `bundle install` to install missing gems"
#   exit e.status_code
# end
# 
# require 'test/unit'
# require 'shoulda'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'fun_with_files'

# class Test::Unit::TestCase
# end

class FunWith::Files::TestCase < FunWith::Testing::TestCase
  include FunWith::Files
  include FunWith::Testing::Assertions::FunWithFiles
  include FunWith::Testing::Assertions::Basics
  
  def tmpdir( &block )
    FilePath.tmpdir do |d|
      @tmpdir = d
      yield
    end
  end
  
  def empty_temp_directory
    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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fun_with_files-0.0.15 ./test/helper.rb
fun_with_files-0.0.14 ./test/helper.rb
fun_with_files-0.0.13 ./test/helper.rb
fun_with_files-0.0.12 ./test/helper.rb