Sha256: f3b549eefe5cda15d1bac706aab04a2243481af9d44c0a98660a7b5aa50d4ff7

Contents?: true

Size: 563 Bytes

Versions: 1

Compression:

Stored size: 563 Bytes

Contents

#!/usr/bin/ruby -w

class MiniTest::Should::TestCase < MiniTest::Spec
  
  class << self
    alias :setup :before
    alias :teardown :after
    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.1 lib/minitest/should/test_case.rb