class Spectator::Block(T)
Overview
Represents a block from a test.
This is typically captured by an expect macro.
It consists of a label and parameter-less block.
The label should be a string recognizable by the user,
or nil if one isn't available.
Defined in:
spectator/block.crConstructors
- 
        .new(block :  -> T, label : Label = nil)
        
          Creates the block expression from a proc. 
- 
        .new(label : Label = nil, &block :  -> T)
        
          Creates the block expression by capturing a block as a proc. 
Instance Method Summary
- 
        #value : T
        
          Evaluates the block and returns the value from it. 
Instance methods inherited from class Spectator::Expression(T)
  
  
    
      raw_value
    raw_value, 
    
  
    
      value : T
    value
    
  
    
  Constructor methods inherited from class Spectator::Expression(T)
  
  
    
      new(label : Label)
    new
    
  
    
  
    
  Instance methods inherited from class Spectator::AbstractExpression
  
  
    
      cast(type : T.class) : T forall T
    cast, 
    
  
    
      inspect(io)
    inspect, 
    
  
    
      label : Label
    label, 
    
  
    
      raw_value
    raw_value, 
    
  
    
      to_s(io)
    to_s
    
  
    
  Constructor methods inherited from class Spectator::AbstractExpression
  
  
    
      new(label : Label)
    new
    
  
    
  
    
    
    
  
    
  Instance methods inherited from class Object
  
  
    
      should(matcher, message = nil)
    should, 
    
  
    
      should_eventually(matcher, message = nil)
    should_eventually, 
    
  
    
      should_never(matcher, message = nil)
    should_never, 
    
  
    
      should_not(matcher, message = nil)
    should_not
    
  
    
    
  
Constructor Detail
Creates the block expression from a proc. The proc will be called to evaluate the value of the expression. The label is usually the Crystal code for the proc. It can be nil if it isn't available.
Creates the block expression by capturing a block as a proc. The block will be called to evaluate the value of the expression. The label is usually the Crystal code for the block. It can be nil if it isn't available.