aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/testing.md
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-11-04 12:33:30 +0100
committerYves Senn <yves.senn@gmail.com>2013-11-04 17:43:05 +0100
commit9c4261351c7b19e2b75ec3a981caafcf26d2def8 (patch)
tree3aafb26db895c426ed08887a8aca13d18dc416ba /guides/source/testing.md
parent6d540d135f8a542bbcbf0b2fa5da39f3d572d5f0 (diff)
downloadrails-9c4261351c7b19e2b75ec3a981caafcf26d2def8.tar.gz
rails-9c4261351c7b19e2b75ec3a981caafcf26d2def8.tar.bz2
rails-9c4261351c7b19e2b75ec3a981caafcf26d2def8.zip
document `BACKTRACE` env var usage in testing guide. [ci skip]
Diffstat (limited to 'guides/source/testing.md')
-rw-r--r--guides/source/testing.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md
index edf4813d74..cf01650b2a 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -359,6 +359,17 @@ Notice the 'E' in the output. It denotes a test with error.
NOTE: The execution of each test method stops as soon as any error or an assertion failure is encountered, and the test suite continues with the next method. All test methods are executed in alphabetical order.
+When a test fails you are presented with the corresponding backtrace. By default
+Rails filters that backtrace and will only print lines relevant to your
+application. This eliminates the framwork noise and helps to focus on your
+code. However there are situations when you want to see the full
+backtrace. simply set the `BACKTRACE` environment variable to enable this
+behavior:
+
+```bash
+$ BACKTRACE=1 rake test test/models/post_test.rb
+```
+
### What to Include in Your Unit Tests
Ideally, you would like to include a test for everything which could possibly break. It's a good practice to have at least one test for each of your validations and at least one test for every method in your model.