Class: RSpec::Matchers::BuiltIn::YieldControl Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::YieldControl
- Defined in:
- lib/rspec/matchers/built_in/yield.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation for yield_control
.
Not intended to be instantiated directly.
Constant Summary
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary (collapse)
-
- (Object) at_least(number)
Specifies the minimum number of times the method is expected to yield.
-
- (Object) at_most(number)
Specifies the maximum number of times the method is expected to yield.
-
- (Object) exactly(number)
Specifies that the method is expected to yield the given number of times.
- - (String) failure_message private
- - (String) failure_message_when_negated private
-
- (YieldControl) initialize
constructor
private
A new instance of YieldControl.
-
- (Object) once
Specifies that the method is expected to yield once.
-
- (Object) thrice
Specifies that the method is expected to yield thrice.
-
- (Object) times
No-op.
-
- (Object) twice
Specifies that the method is expected to yield twice.
Methods inherited from BaseMatcher
#description, #diffable?, #expects_call_stack_jump?, #match_unless_raises
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
- (YieldControl) initialize
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of YieldControl
99 100 101 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 99 def initialize at_least(:once) end |
Instance Method Details
- (Object) at_least(number)
Specifies the minimum number of times the method is expected to yield
140 141 142 143 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 140 def at_least(number) set_expected_yields_count(:>=, number) self end |
- (Object) at_most(number)
Specifies the maximum number of times the method is expected to yield
133 134 135 136 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 133 def at_most(number) set_expected_yields_count(:<=, number) self end |
- (Object) exactly(number)
Specifies that the method is expected to yield the given number of times.
126 127 128 129 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 126 def exactly(number) set_expected_yields_count(:==, number) self end |
- (String) failure_message
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
166 167 168 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 166 def 'expected given block to yield control' + failure_reason end |
- (String) failure_message_when_negated
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
172 173 174 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 172 def 'expected given block not to yield control' + failure_reason end |
- (Object) once
Specifies that the method is expected to yield once.
105 106 107 108 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 105 def once exactly(1) self end |
- (Object) thrice
Specifies that the method is expected to yield thrice.
119 120 121 122 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 119 def thrice exactly(3) self end |
- (Object) times
No-op. Provides syntactic sugar.
147 148 149 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 147 def times self end |
- (Object) twice
Specifies that the method is expected to yield twice.
112 113 114 115 |
# File 'lib/rspec/matchers/built_in/yield.rb', line 112 def twice exactly(2) self end |