提交 3683745c 编写于 作者: R Rohit Arondekar

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

上级 cfc8c7ab
...@@ -241,8 +241,7 @@ h4. Running Tests ...@@ -241,8 +241,7 @@ h4. Running Tests
Running a test is as simple as invoking the file containing the test cases through Ruby: Running a test is as simple as invoking the file containing the test cases through Ruby:
<shell> <shell>
$ cd test $ ruby -Itest test/unit/post_test.rb
$ ruby unit/post_test.rb
Loaded suite unit/post_test Loaded suite unit/post_test
Started Started
...@@ -252,12 +251,12 @@ Finished in 0.023513 seconds. ...@@ -252,12 +251,12 @@ Finished in 0.023513 seconds.
1 tests, 1 assertions, 0 failures, 0 errors 1 tests, 1 assertions, 0 failures, 0 errors
</shell> </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+. You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+.
<shell> <shell>
$ ruby unit/post_test.rb -n test_truth $ ruby -Itest test/unit/post_test.rb -n test_truth
Loaded suite unit/post_test Loaded suite unit/post_test
Started Started
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册