Sha256: 5302d1d609940df5dec6d554cbc4bc147f59d524c7374e16cedc11aad2e58654

Contents?: true

Size: 1.02 KB

Versions: 30

Compression:

Stored size: 1.02 KB

Contents

here = File.expand_path(File.dirname(__FILE__))
PROJ_ROOT = File.expand_path("#{here}/..")
$: << "#{PROJ_ROOT}/lib"
require 'test/unit'
require 'fileutils'
require 'find'
require 'yaml'
require 'ostruct'
require "#{here}/constructor"

class Test::Unit::TestCase
	include FileUtils

	def path_to(file)
		File.expand_path(File.dirname(__FILE__)) + file
	end

	def not_done
		flunk "IMPLEMENT ME"
	end
	alias :implement_me :not_done

	def poll(time_limit) 
		(time_limit * 10).to_i.times do 
			return true if yield
			sleep 0.1
		end
		return false
	end

	def self.method_added(msym)
		# Prevent duplicate test methods 
		if msym.to_s =~ /^test_/
			@_tracked_tests ||= {}
			raise "Duplicate test #{msym}" if @_tracked_tests[msym]
			@_tracked_tests[msym] = true
		end
	end

  #
  # HELPERS
  #
  def path_to_test_file(fname)
    path_to("/files/#{fname}")
  end

  def load_context(file_name)
    hash = YAML.load(File.read(path_to_test_file(file_name)))
    load_hash(hash)
  end

  def load_hash(hash)
    @diy = DIY::Context.new(hash)
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
ceedling-0.31.1 vendor/diy/test/test_helper.rb
ceedling-0.31.0 vendor/diy/test/test_helper.rb
ceedling-0.30.0 vendor/diy/test/test_helper.rb
ceedling-0.28.3 vendor/diy/test/test_helper.rb
ceedling-0.28.2 vendor/diy/test/test_helper.rb
ceedling-0.28.1 vendor/diy/test/test_helper.rb
ceedling-0.27.0 vendor/diy/test/test_helper.rb
ceedling-0.25.0 vendor/diy/test/test_helper.rb
ceedling-0.24.0 vendor/diy/test/test_helper.rb
ceedling-0.22.0 vendor/diy/test/test_helper.rb
ceedling-0.21.0 vendor/diy/test/test_helper.rb
ceedling-0.20.3 vendor/diy/test/test_helper.rb
ceedling-0.20.2 vendor/diy/test/test_helper.rb
ceedling-0.19.0 vendor/diy/test/test_helper.rb
ceedling-0.18.0 vendor/diy/test/test_helper.rb
ceedling-0.17.0 vendor/diy/test/test_helper.rb
ceedling-0.16.0 vendor/diy/test/test_helper.rb
ceedling-0.15.6 vendor/diy/test/test_helper.rb
ceedling-0.15.5 vendor/diy/test/test_helper.rb
ceedling-0.15.4 vendor/diy/test/test_helper.rb