سؤال

using ruby-debug in rspec (through rspec -d), the debugger refuses to step over statements when I execute "next"

It seems to always step into the statement

debugger
params[:appointment][:user_id] = 
  User.where(email: appointment_params[:user_id]).pluck(:id).first if appointment_params[:user_id].to_i == 0
params[:appointment][:country_id] = 
  Country.where(name: appointment_params[:country_id]).pluck(:id).first if appointment_params[:country_id].to_i == 0

@appointment = Appointment.new(appointment_params)

when I hit "n" and press enter, it steps into the User.where statement

I have no idea what might be causing this, any ideas?

هل كانت مفيدة؟

المحلول

You most likely shouldn't be using ruby-debug and should upgrade to a more recent debugger.

Switch to debugger if you're using ruby 1.9.x or to byebug if using ruby 2.x and your problem should be gone. If you switch to byebug, don't use the -d flag, it will only affect performance and it doesn't provide any benefits.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top