I’m in the position that would be really useful for me to run in a
testcase a test belonging to another testcase.
Assuming I do not want to use modules, how could I do that?
My code would be something like this:
class MyTestCase < Test::Rails:TestCase
def myTest
matc = MyAnotherTestCase.new
end
end
The code above seems to work but when I run MyTestCase all the tests
belonging to MyAnotherTestCase are executed.
What would I need to do to execute only a single test from
MyAnotherTestCase?
The code above seems to work but when I run MyTestCase all the tests
belonging to MyAnotherTestCase are executed.
What would I need to do to execute only a single test from
MyAnotherTestCase?
Just a guess, but you could use
MyAnotherTestCase.instance_method(‘test_foo’) to get an UnboundMethod
for test_foo and then bind it to the current instance.
I really would go with either
module
helper methods (that aren’t actually tests) in test_helper.rb (or
create another foo_helper file with those methods)
Fred.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.