module FlexMock::Ordering

################################################################# The ordering module contains the methods and data structures used to determine proper orderring of mocked calls. By providing the functionality in a module, a individual mock object can order its own calls, and the container can provide ordering at a global level.

Public Instance Methods

flexmock_allocate_order() click to toggle source

Allocate the next available order number.

# File lib/flexmock/ordering.rb, line 23
def flexmock_allocate_order
  @flexmock_allocated_order ||= 0
  @flexmock_allocated_order += 1
end
flexmock_current_order() click to toggle source

Current order number in this ordering.

# File lib/flexmock/ordering.rb, line 34
def flexmock_current_order
  @flexmock_current_order ||= 0
end
flexmock_current_order=(value) click to toggle source

Set the current order for this ordering.

# File lib/flexmock/ordering.rb, line 39
def flexmock_current_order=(value)
  @flexmock_current_order = value
end
flexmock_groups() click to toggle source

Hash of groups defined in this ordering.

# File lib/flexmock/ordering.rb, line 29
def flexmock_groups
  @flexmock_groups ||= {}
end
flexmock_validate_order(method_name, order_number) click to toggle source
# File lib/flexmock/ordering.rb, line 43
def flexmock_validate_order(method_name, order_number)
  FlexMock.check("method #{method_name} called out of order " +
    "(expected order #{order_number}, was #{flexmock_current_order})") {
    order_number >= self.flexmock_current_order
  }
  self.flexmock_current_order = order_number
end