Browse files

Guides: Add test directory to load path to run individual test files.

  • Loading branch information...
1 parent 1f92d13 commit c1720fb553e5f9cf461102a8f9aeb2d9a4be82ec @rohit rohit committed with fxn Sep 12, 2010
Showing with 3 additions and 4 deletions.
  1. +3 −4 railties/guides/source/testing.textile
View
7 railties/guides/source/testing.textile
@@ -247,8 +247,7 @@ h4. Running Tests
Running a test is as simple as invoking the file containing the test cases through Ruby:
<shell>
-$ cd test
-$ ruby unit/post_test.rb
+$ ruby -Itest test/unit/post_test.rb
Loaded suite unit/post_test
Started
@@ -258,12 +257,12 @@ Finished in 0.023513 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
</shell>
-This will run all the test methods from the test case.
+This will run all the test methods from the test case. Note that +test_helper.rb+ is in the +test+ directory, hence this directory needs to be added to the load path using the +-I+ switch.
You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+.
<shell>
-$ ruby -Itest test/unit/post_test.rb -n test_the_truth
+$ ruby -Itest test/unit/post_test.rb -n test_truth
Loaded suite unit/post_test
Started

0 comments on commit c1720fb

Please sign in to comment.