Ruby debugger - access to local variables in Rails test

Answered

Hello!

I need to upgrade some old Rails application. During work on that task I have noticed, that in debugger session (tests debugging), when execution is stop on breakpoint there is no access to local variables in Interactive console

I can access all @ variables but trying to access some local object renders error: Error: the evaluation of  [….] failed with the exception 'undefined local variable or method `part' for […]  This happen for breakpoints inside test code. When breakpoint is in application code I have access to local variables. Also when application server is run locally and stopped on breakpoint RM debugger has access to local variables.

Is there any way to access local variables defined in tests during debugging session?

 

Regards,

0
2 comments

Hello,

Would it be possible to provide a minimal project sample for reproduce? I've tried it in our sample app in RubyMine 2024.1.1, but local variables in tests were available when the breakpoint was hit inside the test block.

0

Hello

I will try to create such project and test it. I didn't mention that is old project being now upgraded. As such it run on MRI ruby 2.6.10 and is based on Rails 5.0.7.2

0

Please sign in to leave a comment.