Skip to content

Commit a65e121

Browse files
princejosephclaude
andcommitted
Fix Timecop monkey patch for timecop 0.9.x internal API change
timecop 0.9.x replaced @_stack/@baseline instance variables with stack/set_stack/baseline/set_baseline accessor methods (for thread-safe support). Update the Lolex monkey patch to use the new API. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 91b35b0 commit a65e121

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

ruby/hyper-spec/lib/hyper-spec/internal/time_cop.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ def travel(mock_type, *args, &block)
169169

170170
stack_item = TimeStackItem.new(mock_type, *args)
171171

172-
stack_backup = @_stack.dup
173-
@_stack << stack_item
172+
stack_backup = stack.dup
173+
stack << stack_item
174174

175175
Lolex.push(mock_type, *args)
176176

@@ -179,25 +179,25 @@ def travel(mock_type, *args, &block)
179179
yield stack_item.time
180180
ensure
181181
Lolex.pop
182-
@_stack.replace stack_backup
182+
set_stack stack_backup
183183
end
184184
end
185185
end
186186

187187
def return(&block)
188-
current_stack = @_stack
189-
current_baseline = @baseline
188+
current_stack = stack
189+
current_baseline = baseline
190190
unmock!
191191
yield
192192
ensure
193193
Lolex.restore
194-
@_stack = current_stack
195-
@baseline = current_baseline
194+
set_stack current_stack
195+
set_baseline current_baseline
196196
end
197197

198198
def unmock! #:nodoc:
199-
@baseline = nil
200-
@_stack = []
199+
set_baseline nil
200+
set_stack []
201201
Lolex.unmock
202202
end
203203
end

0 commit comments

Comments
 (0)