Module: Kernel (Ruby 2.7.5)
Description: Module : Kernel - Ruby 2.7.5

### Home Classes Methods

### In Files

- minitest-5.13.0/lib/minitest/spec.rb

### Methods

- #describe

### 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.

# Kernel

`Kernel` extensions for minitest

### Private Instance Methods

describe(desc, *additional_desc, &block) click to toggle source

Describe a series of expectations for a given target `desc`.

Defines a test class subclassing from either `Minitest::Spec` or from the surrounding describe's class. The surrounding class may subclass `Minitest::Spec` manually in order to easily share code:

    class MySpec < Minitest::Spec
      # ... shared code ...
    end

    class TestStuff < MySpec
      it "does stuff" do
        # shared code available here
      end
      describe "inner stuff" do
        it "still does stuff" do
          # ...and here
        end
      end
    end

For more information on getting started with writing specs, see:

www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html

For some suggestions on how to improve your specs, try:

betterspecs.org

but do note that several items there are debatable or specific to rspec.

For more information about expectations, see `Minitest::Expectations`.

                   # File minitest-5.13.0/lib/minitest/spec.rb, line 75
    def describe desc, *additional_desc, &block # :doc:
      stack = Minitest::Spec.describe_stack
      name  = [stack.last, desc, *additional_desc].compact.join("::")
      sclas = stack.last || if Class === self && kind_of?(Minitest::Spec::DSL) then
                              self
                            else
                              Minitest::Spec.spec_type desc, *additional_desc
                            end

      cls = sclas.create name, desc

      stack.push cls
      cls.class_eval(&block)
      stack.pop
      cls
    end