From c8b24cc2675aceb020a8b8c8ee46854ab30d0125 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Tue, 3 Nov 2015 19:18:56 -0500 Subject: Update docs/comments to use setup/teardown blocks vs. methods. As discussed in the minitest-spec-rails issue (http://git.io/vlHxx) Rails uses setup/teardown callbacks. Defining `setup` or `teardown` methods vs. blocks will yield inconsistent behavior in the callback chain. --- guides/source/active_model_basics.md | 6 +++--- guides/source/testing.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'guides/source') diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md index fe2501bd87..8f8256c983 100644 --- a/guides/source/active_model_basics.md +++ b/guides/source/active_model_basics.md @@ -8,10 +8,10 @@ classes. Active Model allows for Action Pack helpers to interact with plain Ruby objects. Active Model also helps build custom ORMs for use outside of the Rails framework. -After reading this guide, you will know: +After reading this guide, you will know: * How an Active Record model behaves. -* How Callbacks and validations work. +* How Callbacks and validations work. * How serializers work. * The Rails internationalization (i18n) framework. @@ -428,7 +428,7 @@ the Active Model API. class PersonTest < ActiveSupport::TestCase include ActiveModel::Lint::Tests - def setup + setup do @model = Person.new end end diff --git a/guides/source/testing.md b/guides/source/testing.md index a07772036b..2f941a8280 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -908,12 +908,12 @@ require 'test_helper' class ArticlesControllerTest < ActionController::TestCase # called before every single test - def setup + setup do @article = articles(:one) end # called after every single test - def teardown + teardown do # when controller is using cache it may be a good idea to reset it afterwards Rails.cache.clear end -- cgit v1.2.3