Sha256: 370f6156cfad2508f8cde6e7536cac8337c6e94021796742365fbc63a3d10a86

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

#!/usr/bin/ruby -w

class MiniTest::Should::TestCase < MiniTest::Spec
  
  class << self
    alias :setup :before unless defined?(Rails)
    alias :teardown :after unless defined?(Rails)
    alias :context :describe
  end
  
  def self.should(name, &block)
    method_name = [ "test_should_", name.downcase.gsub(/[^a-z0-9\_\s]+/, ' ').strip.gsub(/\s+/, "_") ].join
    if self.test_methods.include?(method_name)
      raise MiniTest::Should::DuplicateMethodError, "Test named `#{method_name}` already exists in #{self.name}." 
    else
      self.send(:define_method, method_name, block)
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minitest_should-0.3.0 lib/minitest/should/test_case.rb