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.
This commit is contained in:
Ken Collins 2015-11-03 19:18:56 -05:00
parent e37b470a66
commit c8b24cc267
3 changed files with 6 additions and 6 deletions

@ -10,7 +10,7 @@ class LogSubscriber
# class SyncLogSubscriberTest < ActiveSupport::TestCase
# include ActiveSupport::LogSubscriber::TestHelper
#
# def setup
# setup do
# super
# ActiveRecord::LogSubscriber.attach_to(:active_record)
# end

@ -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

@ -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