module Minitest::Runnable

Allow Minitest to support RSpec's metadata (eg tagging) Thus you can tag a test or a class, and then pass `-t mytag` to mrspec, and it will only run the tagged code.

Public Class Methods

class_metadata() click to toggle source
# File lib/mrspec/minitest_metadata.rb, line 17
def class_metadata
  @selfmetadata ||= {}
end
classmeta(metadata) click to toggle source

Add metadata to the current class

# File lib/mrspec/minitest_metadata.rb, line 8
def classmeta(metadata)
  class_metadata.merge! metadata
end
example_metadata() click to toggle source
# File lib/mrspec/minitest_metadata.rb, line 21
def example_metadata
  @metadata ||= Hash.new { |metadata, mname| metadata[mname] = {} }
end
meta(metadata) click to toggle source

Add metadata to the next defined test

# File lib/mrspec/minitest_metadata.rb, line 13
def meta(metadata)
  pending_metadata.merge! metadata
end

Private Class Methods

method_added(manme) click to toggle source
# File lib/mrspec/minitest_metadata.rb, line 27
def method_added(manme)
  example_metadata[manme.intern].merge! pending_metadata
  pending_metadata.clear
end
pending_metadata() click to toggle source
# File lib/mrspec/minitest_metadata.rb, line 32
def pending_metadata
  @pending_metadata ||= {}
end