Sha256: d8c9bc934e4aa21a32d8ea980d86b0819c32f8b4b6bcf8f746e99c7932c42aee

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

require 'test/unit'
require 'rspec/expectations'

class BaseTest < Test::Unit::TestCase
  # Copied from Rails; makes a test method using a string
  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
        raise "No implementation provided for #{name}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
methadone-0.1.0 test/base_test.rb
methadone-0.0.2 test/base_test.rb
methadone-0.0.1 test/base_test.rb