class RSpec::Mocks::OrderGroup

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/rspec/mocks/order_group.rbs

class RSpec::Mocks::OrderGroup
  def handle_order_constraint: (RSpec::Mocks::MessageExpectation expectation) -> nil
  def initialize: () -> void
  def invoked: (RSpec::Mocks::Proxy::SpecificMessage message) -> untyped
end

@private

def clear

def clear
  @index = 0
  @invocation_order.clear
  @expectations.clear
end

def consume

Other tags:
    Private: -
def consume
  remaining_expectations.each_with_index do |expectation, index|
    next unless expectation.ordered?
    @index += index + 1
    return expectation
  end
  nil
end

def empty?

def empty?
  @expectations.empty?
end

def expectation_for(message)

def expectation_for(message)
  @expectations.find { |e| message == e }
end

def expectations_invoked_in_order?

def expectations_invoked_in_order?
  invoked_expectations == expected_invocations
end

def expected_invocations

def expected_invocations
  @invocation_order.map { |invocation| expectation_for(invocation) }.compact
end

def handle_order_constraint(expectation)

Experimental RBS support (using type sampling data from the type_fusion project).

def handle_order_constraint: (RSpec::Mocks::MessageExpectation expectation) -> nil

This signature was generated using 3 samples from 1 application.

Other tags:
    Private: -
def handle_order_constraint(expectation)
  return unless expectation.ordered? && remaining_expectations.include?(expectation)
  return consume if ready_for?(expectation)
  expectation.raise_out_of_order_error
end

def initialize

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: () -> void

This signature was generated using 1 sample from 1 application.

def initialize
  @expectations = []
  @invocation_order = []
  @index = 0
end

def invoked(message)

Experimental RBS support (using type sampling data from the type_fusion project).

def invoked: (RSpec::Mocks::Proxy::SpecificMessage message) -> untyped

This signature was generated using 1 sample from 1 application.

def invoked(message)
  @invocation_order << message
end

def invoked_expectations

def invoked_expectations
  @expectations.select { |e| e.ordered? && @invocation_order.include?(e) }
end

def ready_for?(expectation)

Other tags:
    Private: -
def ready_for?(expectation)
  remaining_expectations.find(&:ordered?) == expectation
end

def register(expectation)

Other tags:
    Private: -
def register(expectation)
  @expectations << expectation
end

def remaining_expectations

def remaining_expectations
  @expectations[@index..-1] || []
end

def verify_invocation_order(expectation)

def verify_invocation_order(expectation)
  expectation.raise_out_of_order_error unless expectations_invoked_in_order?
  true
end