Sha256: 33ef7b3928222b71f66742c35c36b356d4882b5e46f128d5f4779b1a47453378

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

require 'rubygems'
require 'test/unit'
require 'test/libxml_test_helper'

# Thought a mock library will be useful for testing out any stuff that 
# does any http-ing, but have no strong feelings about which one to use.
# Looking at the syntax of each of the libraries, I liked the look of the
# mocha syntax more, so was thinking to use that when required.
#
# require 'flexmock'
require 'mocha'



#consider adding custom assertions to clean code up
#http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit/Assertions.html


# Tiny patch to Test::Unit that lets us write our tests in a slightly 
# more rspec style way. Similar thing is used in jeremymcanally's context
# gem (http://github.com/jeremymcanally/context/tree/master), but thought
# could do without the extra dependency
class Test::Unit::TestCase
  def self.test(name, &block)
    test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
    defined = instance_method(test_name) rescue false
    raise "#{test_name} is already defined in #{self}" if defined
    if block_given?
      define_method(test_name, &block)
    else
      define_method(test_name) do
        flunk "No implementation provided for #{name}"
      end
    end
  end

  def self.implement(name, &block)
    puts "UNIMPLEMENTED: #{name}"
  end

  def add_line_numbers(str)
    return nil if str.nil?
    out = ''
    str.split(/\n/).each_with_index do |line, i|
      out << "#{i+1}: #{line}\n"
    end
    out
  end

end

$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

require 'eeml'

include Eeml

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eeml-0.0.1 test/test_helper.rb