Module: Minitest::Spec::DSL::InstanceMethods (Ruby 2.7.5)
Description: Module : Minitest::Spec::DSL::InstanceMethods - Ruby 2.7.5

### Home Classes Methods

### In Files

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

### Methods

- #_
- #expect
- #value

### 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::Spec::DSL::InstanceMethods

Rdoc… why are you so dumb?

### Public Instance Methods

_(value = nil, &block) click to toggle source

Takes a value or a block and returns a value monad that has all of Expectations methods available to it.

    _(1 + 1).must_equal 2

And for blocks:

    _ { 1 + "1" }.must_raise TypeError

This method of expectation-based testing is preferable to straight-expectation methods (on `Object`) because it stores its test context, bypassing our hacky use of thread-local variables.

NOTE: At some point, the methods on `Object` will be deprecated and then removed.

It is also aliased to `value` and `expect` for your aesthetic pleasure:

         _(1 + 1).must_equal 2
     value(1 + 1).must_equal 2
    expect(1 + 1).must_equal 2

                   # File minitest-5.13.0/lib/minitest/spec.rb, line 315
    def _ value = nil, &block
      Minitest::Expectation.new block || value, self
    end

Also aliased as: value, expect
expect(value = nil, &block) click to toggle source
Alias for: _
value(value = nil, &block) click to toggle source
Alias for: _