lilingjay lilingjay - 10 months ago 42
Ruby Question

How to get the current testcase name in test-unit?

example:

def setup
end

def teardown
end


How do I get the current case name in the setup method?

Answer

In Ruby 1.9.3, you can do something like this:

def setup
  puts self.__name__
end