A rake question...running rspec tests in different directories

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:

« Test_spec.rb
«lib directory
« component1_helper.rb

« 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.



On Mar 24, 12:47špm, Jim K. [email protected] wrote:

« Test_spec.rb
«lib directory
š « component1_helper.rb

« Test_spec.rb
«lib directory
š « component2_helper.rb

Nice use of box-drawing characters.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs