Module: FlexMock::Ordering
- Included in:
- FlexMock, MockContainer, PartialMockProxy
- Defined in:
- lib/gems/flexmock-0.8.3/lib/flexmock/ordering.rb,
lib/gems/flexmock-0.8.3/lib/flexmock/deprecated_methods.rb
Overview
################################################################# 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.
Instance Method Summary collapse
-
#flexmock_allocate_order ⇒ Object
Allocate the next available order number.
-
#flexmock_current_order ⇒ Object
Current order number in this ordering.
-
#flexmock_current_order=(value) ⇒ Object
Set the current order for this ordering.
-
#flexmock_groups ⇒ Object
Hash of groups defined in this ordering.
- #flexmock_validate_order(method_name, order_number) ⇒ Object
Instance Method Details
#flexmock_allocate_order ⇒ Object
Allocate the next available order number.
23 24 25 26 |
# File 'lib/gems/flexmock-0.8.3/lib/flexmock/ordering.rb', line 23 def flexmock_allocate_order @flexmock_allocated_order ||= 0 @flexmock_allocated_order += 1 end |
#flexmock_current_order ⇒ Object
Current order number in this ordering.
34 35 36 |
# File 'lib/gems/flexmock-0.8.3/lib/flexmock/ordering.rb', line 34 def flexmock_current_order @flexmock_current_order ||= 0 end |
#flexmock_current_order=(value) ⇒ Object
Set the current order for this ordering.
39 40 41 |
# File 'lib/gems/flexmock-0.8.3/lib/flexmock/ordering.rb', line 39 def flexmock_current_order=(value) @flexmock_current_order = value end |
#flexmock_groups ⇒ Object
Hash of groups defined in this ordering.
29 30 31 |
# File 'lib/gems/flexmock-0.8.3/lib/flexmock/ordering.rb', line 29 def flexmock_groups @flexmock_groups ||= {} end |
#flexmock_validate_order(method_name, order_number) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/gems/flexmock-0.8.3/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 |