On 8 Nov 2007, at 14:33, Emanuele Ricci wrote:
>
> 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?
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---