Skip to content
Browse files

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

  • Loading branch information...
1 parent cfc8c7a commit 3683745cbc94a60e1cf60d86c9cb62f067182de3 @rohit rohit committed 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
@@ -241,8 +241,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
@@ -252,12 +251,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 unit/post_test.rb -n test_truth
+$ ruby -Itest test/unit/post_test.rb -n test_truth
Loaded suite unit/post_test
Started

0 comments on commit 3683745

Please sign in to comment.
Something went wrong with that request. Please try again.