Minitest::Spec::DSL::InstanceMethods

module Minitest::Spec::DSL::InstanceMethods

Rdoc… why are you so dumb?

Public Instance Methods

_(value = nil, &block) Show source

Returns a value monad that has all of Expectations methods available to it.

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

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.

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

# File lib/minitest/spec.rb, line 304
def _ value = nil, &block
  Minitest::Expectation.new block || value, self
end
Also aliased as: value, expect
expect(value = nil, &block)
Alias for: _
value(value = nil, &block)
Alias for: _

© Ryan Davis, seattle.rb
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部