Class: Spec::Mocks::OrderGroup

Class | Spec::Mocks::OrderGroup
In: | lib/spec/mocks/order_group.rb
Parent: | Object

### Methods

consume handle_order_constraint new ready_for? register

### Public Class methods

new(error_generator)

[Source]

       # File lib/spec/mocks/order_group.rb, line 4
    4:       def initialize error_generator
    5:         @error_generator = error_generator
    6:         @ordering = Array.new
    7:       end

### Public Instance methods

consume()

[Source]

        # File lib/spec/mocks/order_group.rb, line 17
    17:       def consume
    18:         @ordering.shift
    19:       end

handle_order_constraint(expectation)

[Source]

        # File lib/spec/mocks/order_group.rb, line 21
    21:       def handle_order_constraint expectation
    22:         return unless @ordering.include? expectation
    23:         return consume if ready_for?(expectation)
    24:         @error_generator.raise_out_of_order_error expectation.sym
    25:       end

ready_for?(expectation)

[Source]

        # File lib/spec/mocks/order_group.rb, line 13
    13:       def ready_for?(expectation)
    14:         return @ordering.first == expectation
    15:       end

register(expectation)

[Source]

        # File lib/spec/mocks/order_group.rb, line 9
     9:       def register(expectation)
    10:         @ordering << expectation
    11:       end

[Validate]