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
Constants inherited from BaseMatcher
Instance Method Summary collapse
- 
  
      #at_least(number)  ⇒ Object 
  
    
Specifies the minimum number of times the method is expected to yield.
 - 
  
      #at_most(number)  ⇒ Object 
  
    
Specifies the maximum number of times the method is expected to yield.
 - 
  
      #exactly(number)  ⇒ Object 
  
    
Specifies that the method is expected to yield the given number of times.
 - #failure_message ⇒ String private
 - #failure_message_when_negated ⇒ String private
 - 
  
      #initialize  ⇒ YieldControl 
  
    constructor
  private
    
A new instance of YieldControl.
 - 
  
      #once  ⇒ Object 
  
    
Specifies that the method is expected to yield once.
 - 
  
      #thrice  ⇒ Object 
  
    
Specifies that the method is expected to yield thrice.
 - 
  
      #times  ⇒ Object 
  
    
No-op.
 - 
  
      #twice  ⇒ Object 
  
    
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
#initialize ⇒ YieldControl
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.
      100 101 102  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 100 def initialize at_least(:once) end  | 
  
Instance Method Details
#at_least(number) ⇒ Object
Specifies the minimum number of times the method is expected to yield
      141 142 143 144  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 141 def at_least(number) set_expected_yields_count(:>=, number) self end  | 
  
#at_most(number) ⇒ Object
Specifies the maximum number of times the method is expected to yield
      134 135 136 137  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 134 def at_most(number) set_expected_yields_count(:<=, number) self end  | 
  
#exactly(number) ⇒ Object
Specifies that the method is expected to yield the given number of times.
      127 128 129 130  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 127 def exactly(number) set_expected_yields_count(:==, number) self end  | 
  
#failure_message ⇒ String
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.
      167 168 169  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 167 def 'expected given block to yield control' + failure_reason end  | 
  
#failure_message_when_negated ⇒ String
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.
      173 174 175  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 173 def 'expected given block not to yield control' + failure_reason end  | 
  
#once ⇒ Object
Specifies that the method is expected to yield once.
      106 107 108 109  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 106 def once exactly(1) self end  | 
  
#thrice ⇒ Object
Specifies that the method is expected to yield thrice.
      120 121 122 123  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 120 def thrice exactly(3) self end  | 
  
#times ⇒ Object
No-op. Provides syntactic sugar.
      148 149 150  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 148 def times self end  | 
  
#twice ⇒ Object
Specifies that the method is expected to yield twice.
      113 114 115 116  | 
    
      # File 'lib/rspec/matchers/built_in/yield.rb', line 113 def twice exactly(2) self end  |