Module: Minitest::Test::LifecycleHooks (Ruby 2.7.5)
Description: Module : Minitest::Test::LifecycleHooks - Ruby 2.7.5

### Home Classes Methods

### In Files

- minitest-5.13.0/lib/minitest/test.rb

### Methods

- #after_setup
- #after_teardown
- #before_setup
- #before_teardown
- #setup
- #teardown

### Files

- History.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Kernel
- Minitest::AbstractReporter
- Minitest::Assertion
- Minitest::Assertions
- Minitest::BacktraceFilter
- Minitest::BenchSpec
- Minitest::Benchmark
- Minitest::CompositeReporter
- Minitest::Expectations
- Minitest::Guard
- Minitest::Mock
- Minitest::Parallel
- Minitest::Parallel::Executor
- Minitest::PrideIO
- Minitest::PrideLOL
- Minitest::ProgressReporter
- Minitest::Reportable
- Minitest::Result
- Minitest::Skip
- Minitest::Spec
- Minitest::Spec::DSL
- Minitest::Spec::DSL::InstanceMethods
- Minitest::StatisticsReporter
- Minitest::SummaryReporter
- Minitest::Test
- Minitest::Test::LifecycleHooks
- Minitest::UnexpectedError
- Object
- SubThingySpec
- ThingySpec

No matching classes.

# Minitest::Test::LifecycleHooks

Provides before/after hooks for setup and teardown. These are meant for library writers, NOT for regular test authors. See `before_setup` for an example.

### Public Instance Methods

after_setup() click to toggle source

Runs before every test, after setup. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.

See `before_setup` for an example.

                   # File minitest-5.13.0/lib/minitest/test.rb, line 167
    def after_setup; end

after_teardown() click to toggle source

Runs after every test, after teardown. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.

See `before_setup` for an example.

                   # File minitest-5.13.0/lib/minitest/test.rb, line 191
    def after_teardown; end

before_setup() click to toggle source

Runs before every test, before setup. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.

As a simplistic example:

    module MyMinitestPlugin
      def before_setup
        super
        # ... stuff to do before setup is run
      end

      def after_setup
        # ... stuff to do after setup is run
        super
      end

      def before_teardown
        super
        # ... stuff to do before teardown is run
      end

      def after_teardown
        # ... stuff to do after teardown is run
        super
      end
    end

    class MiniTest::Test
      include MyMinitestPlugin
    end

                   # File minitest-5.13.0/lib/minitest/test.rb, line 152
    def before_setup; end

before_teardown() click to toggle source

Runs after every test, before teardown. This hook is meant for libraries to extend minitest. It is not meant to be used by test developers.

See `before_setup` for an example.

                   # File minitest-5.13.0/lib/minitest/test.rb, line 176
    def before_teardown; end

setup() click to toggle source

Runs before every test. Use this to set up before each test run.

                   # File minitest-5.13.0/lib/minitest/test.rb, line 158
    def setup; end

teardown() click to toggle source

Runs after every test. Use this to clean up after each test run.

                   # File minitest-5.13.0/lib/minitest/test.rb, line 182
    def teardown; end