模块: RSpec::Expectations::ExpectationTarget::InstanceMethods
- 定义于
- lib/rspec/expectations/expectation_target.rb
概述
定义实例 RSpec::Expectations::ExpectationTarget 实例方法。这些方法在模块中定义,因此我们可以将其包含在 Minitest::Expectation
中,当加载 rspec/expectations/minitest_integration
时,以支持与 Minitest 的使用。
实例方法摘要 收起
-
#not_to(matcher = nil, message = nil, &block) ⇒ Boolean (also: #to_not)
运行给定的期望,如果
matcher
返回 false,则通过。 -
#to(matcher = nil, message = nil, &block) ⇒ Boolean
运行给定的期望,如果
matcher
返回 true,则通过。
实例方法详情
#not_to(matcher = nil, message = nil, &block) ⇒Boolean 也称为: to_not
运行给定的期望,如果 matcher
返回 false,则通过。
76 77 78 79 |
# File 'lib/rspec/expectations/expectation_target.rb', line 76 def not_to(matcher=nil, =nil, &block) prevent_operator_matchers(:not_to) unless matcher RSpec::Expectations::NegativeExpectationHandler.handle_matcher(target, matcher, , &block) end |
#to(matcher = nil, message = nil, &block) ⇒Boolean
运行给定的期望,如果 matcher
返回 true,则通过。
63 64 65 66 |
# File 'lib/rspec/expectations/expectation_target.rb', line 63 def to(matcher=nil, =nil, &block) prevent_operator_matchers(:to) unless matcher RSpec::Expectations::PositiveExpectationHandler.handle_matcher(target, matcher, , &block) end |