ruby-on-rails Puma导致Ruby 3 Debug在按箭头键时显示ANSI转义序列(Mac ZSH)

4sup72z8  于 2022-12-20  发布在  Ruby
关注(0)|答案(1)|浏览(95)

我在Mac OS 12.3.1上使用Z shell。
在Puma 5.6.4和Ruby 3.0.0中使用Ruby Debug gem(1.5)时,箭头键不起作用,而是打印出ANSI转义序列(例如,^[[A代表up)。如果我理解正确,Puma运行在/bin/sh上,它不支持箭头键。
当然,我不是唯一一个尝试在Mac上调试Rails 7应用程序的人,还有其他人遇到过这种情况并有解决办法吗?

nxagd54h

nxagd54h1#

我有同样的问题debug宝石。我发现它是由databasecleaner造成的。
我的解决方法是

RSpec.configure do |config|
  config.before(:suite) do
    #DatabaseCleaner[:mongoid].clean_with(:deletion)
  end
  config.before(:each) do
    # DatabaseCleaner[:mongoid].strategy = :deletion
  end
  config.before(:each, :js => true) do
    #DatabaseCleaner[:mongoid].strategy = :deletion
  end
  config.before(:each) do
    DatabaseCleaner.start
  end
  config.after(:each) do
    # DatabaseCleaner.clean
  end
  config.before(:all) do
    # DatabaseCleaner.start
  end
  config.after(:all) do
    # DatabaseCleaner.clean
  end
end

相关问题