@@ -438,7 +438,7 @@ def initialize(error_generator, expectation_ordering, expected_from, method_doub
438
<
8000
/td>438
@ordered = false
439
439
@at_least = @at_most = @exactly = nil
440
440
441
- self . invoking = false
441
+ self . invoking_internals = false
442
442
443
443
# Initialized to nil so that we don't allocate an array for every
444
444
# mock or stub. See also comment in `and_yield`.
@@ -475,7 +475,7 @@ def safe_invoke(parent_stub, *args, &block)
475
475
ruby2_keywords :safe_invoke if respond_to? ( :ruby2_keywords , true )
476
476
477
477
def invoke ( parent_stub , *args , &block )
478
- if invoking
478
+ if invoking_internals
479
479
safe_invoke_without_incrementing_received_count ( parent_stub , *args , &block )
480
480
else
481
481
invoke_incrementing_actual_calls_by ( 1 , true , parent_stub , *args , &block )
@@ -486,6 +486,7 @@ def invoke(parent_stub, *args, &block)
486
486
def safe_invoke_without_incrementing_received_count ( parent_stub , *args , &block )
487
487
invoke_incrementing_actual_calls_by ( 0 , false , parent_stub , *args , &block )
488
488
end
489
+ ruby2_keywords :safe_invoke_without_incrementing_received_count if respond_to? ( :ruby2_keywords , true )
489
490
490
491
def invoke_without_incrementing_received_count ( parent_stub , *args , &block )
491
492
invoke_incrementing_actual_calls_by ( 0 , true , parent_stub , *args , &block )
@@ -613,18 +614,18 @@ def exception_source_id
613
614
@exception_source_id ||= "#{ self . class . name } #{ __id__ } "
614
615
end
615
616
616
- def invoking
617
- RSpec ::Support . thread_local_data [ :"__rspec_#{ object_id } _invoking " ]
617
+ def invoking_internals
618
+ RSpec ::Support . thread_local_data [ :"__rspec_#{ object_id } _invoking_internals " ]
618
619
end
619
620
620
- def invoking = ( value )
621
- RSpec ::Support . thread_local_data [ :"__rspec_#{ object_id } _invoking " ] = value
621
+ def invoking_internals = ( value )
622
+ RSpec ::Support . thread_local_data [ :"__rspec_#{ object_id } _invoking_internals " ] = value
622
623
end
623
624
624
625
def invoke_incrementing_actual_calls_by ( increment , allowed_to_fail , parent_stub , *args , &block )
625
- args . unshift ( orig_object ) if yield_receiver_to_implementation_block?
626
+ self . invoking_internals = true
626
627
627
- self . invoking = true
628
+ args . unshift ( orig_object ) if yield_receiver_to_implementation_block?
628
629
629
630
if negative? || ( allowed_to_fail && ( @exactly || @at_most ) && ( @actual_received_count == @expected_received_count ) )
630
631
# args are the args we actually received, @argument_list_matcher is the
@@ -639,13 +640,15 @@ def invoke_incrementing_actual_calls_by(increment, allowed_to_fail, parent_stub,
639
640
640
641
@order_group . handle_order_constraint self
641
642
643
+ self . invoking_internals = false
644
+
642
645
if implementation . present?
643
646
implementation . call ( *args , &block )
644
647
elsif parent_stub
645
648
parent_stub . invoke ( nil , *args , &block )
646
649
end
647
650
ensure
648
- self . invoking = false
651
+ self . invoking_internals = false
649
652
@actual_received_count_write_mutex . synchronize do
650
653
@actual_received_count += increment
651
654
end
0 commit comments