module Maxitest::Testrbl
def test_pattern_from_match(method, test_name)
def test_pattern_from_match(method, test_name) regex = Regexp.escape(test_name).gsub("\\ "," ").gsub(INTERPOLATION, ".*") regex = if method == "test" # test "xxx -_ yyy" # test-unit: "test: xxx -_ yyy" # activesupport: "test_xxx_-__yyy" "^test(: |_)#{regex.gsub(" ", ".")}$" elsif method == "describe" || (method == "context" && !via_shoulda?) "#{regex}(::)?" elsif method == "should" && via_shoulda? optional_test_name = "(?:\(.*\))?" "#{method} #{regex}\. #{optional_test_name}$" elsif ["it", "should"].include?(method) # minitest aliases for shoulda "#test_\\d+_#{regex}$" else regex end regex.gsub("'", ".") end