Forum: Ruby A rake question...running rspec tests in different directories

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jim K. (Guest)
on 2009-03-24 19:51
(Received via mailing list)
So, I have something I need to do with Rake that I don't know how to
do, but seems like it would be possible...

- I have RSpec tests in multiple directories (for different
components).  Each component has its own lib directory.  The tests
refer to their respective lib directory as a relative path ('./lib').
Everything works fine if  I have a rake file that runs the test from
the directory where the test file is.  But if I try to set up a task
to run all the tests, the tests get confused, because they can't find
the helper scripts and files in their respective lib directories.  So,
here is an example of how the directory structure is set up:

Component1
« Test_spec.rb
«lib directory
  « component1_helper.rb

Component2
« Test_spec.rb
«lib directory
  « component2_helper.rb

I want to run a single task that runs all the tests for component 1
and component 2, and reports the results as a single test run.

So, it seems that for each component I need to change to the
components directory, then run the tests from that directory context.
Then, report the results as a single test run.  Can this be done with
Rake?  I'm sorry if this is an easy question that's been answered
somewhere else...couldn't find anywhere how to do this.

Thanks,

Jim
Yossef M. (Guest)
on 2009-03-24 20:40
(Received via mailing list)
On Mar 24, 12:47špm, Jim K. <removed_email_address@domain.invalid> wrote:
> Component1
> « Test_spec.rb
> «lib directory
> š « component1_helper.rb
>
> Component2
> « Test_spec.rb
> «lib directory
> š « component2_helper.rb

Nice use of box-drawing characters.
This topic is locked and can not be replied to.