class RSpec::Expectations::ExpectationTarget
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/rspec/expectations/expectation_target.rbs class RSpec::Expectations::ExpectationTarget def self.for: ((true | Array[Class] | Array[String]) value, nil block) -> RSpec::Expectations::ValueExpectationTarget end
directly by users. Use ‘expect` instead.
@note `ExpectationTarget` is not intended to be instantiated
expect(actual).not_to eq(3)
# with `not_to`
expect(actual).to eq(3)
# used with `to`
expect { do_something } # => ExpectationTarget wrapping the block
expect(something) # => ExpectationTarget wrapping something
@example
Wraps the target of an expectation.
def self.for(value, block)
Experimental RBS support (using type sampling data from the type_fusion
project).
def self.for: ((true | Class | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String | String) value, nil block) -> RSpec::Expectations::ValueExpectationTarget
This signature was generated using 13 samples from 1 application.
- Private: -
def self.for(value, block) if UndefinedValue.equal?(value) unless block raise ArgumentError, "You must pass either an argument or a block to `expect`." end BlockExpectationTarget.new(block) elsif block raise ArgumentError, "You cannot pass both an argument and a block to `expect`." else ValueExpectationTarget.new(value) end end
def initialize(value)
- Api: - private
def initialize(value) @target = value end