aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKir Shatrov <shatrov@me.com>2015-01-03 23:45:50 +0100
committerKir Shatrov <shatrov@me.com>2015-01-03 23:45:50 +0100
commitef7274be877dc89d232b104e93b5022b56360820 (patch)
tree7535c0f34824fc612ae499963b0d9ffc0280225d
parentcf87cfeb5730ab9982adcb0a6b5608c7e75b3fa0 (diff)
downloadrails-ef7274be877dc89d232b104e93b5022b56360820.tar.gz
rails-ef7274be877dc89d232b104e93b5022b56360820.tar.bz2
rails-ef7274be877dc89d232b104e93b5022b56360820.zip
Better example of `teardown` method in test guide
rails/rails#18305, thanks for @dhh suggestion
-rw-r--r--guides/source/testing.md6
1 files changed, 2 insertions, 4 deletions
diff --git a/guides/source/testing.md b/guides/source/testing.md
index 065ca71d48..a685d95c19 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -753,10 +753,8 @@ class ArticlesControllerTest < ActionController::TestCase
# called after every single test
def teardown
- # as we are re-initializing @article before every test
- # setting it to nil here is not essential but I hope
- # you understand how you can use the teardown method
- @article = nil
+ # when controller is using cache it may be a good idea to reset it afterwards
+ Rails.cache.clear
end
test "should show article" do