Displaying 1 result from an estimated 1 matches for "class_under_test".
2006 Jun 13
3
Dynamic determination of class under test...
...er than rails,
but I can''t seem to locate the answer -- given a string containing a class name
is there a way to
a) check if that class is defined/locatable for inclusion
b) convert the string to a Class object for the named class
Ie, I''m trying to do:
def setup
@klass=class_under_test(self.class)
end
protected
def class_under_test(klass)
/([A-Z][a-z_]*)Test/.match(klass.to_s)
$1 # <----- Now I have a string, not a Class, obviously
# Of course I need a more complete alogrithm here, but I''d like to
# to get the base case working first, do...