ruby-on-rails 测试环境中Omniauth错误的全回溯

ie3xauqp  于 2023-02-17  发布在  Ruby
关注(0)|答案(1)|浏览(169)

当使用omniauth模拟运行自动化测试时,我得到:

Run options: -b --seed 58490    

# Running:

D, [2023-02-14T18:24:28.454047 #7345] DEBUG -- omniauth: (github) Setup endpoint detected, running now.
E, [2023-02-14T18:24:28.457195 #7345] ERROR -- omniauth: (github) Authentication failure! undefined method `settings_object' for nil:NilClass: NoMethodError, undefined method `settings_object' for nil:NilClass
F

Failure:
Sessions::OmniauthControllerTes#test_should_create_a_github_session [/opt/web/test/controllers/sessions/omniauth_controller_test.rb:13]:
"Session.count" didn't change by 1.
Expected: 1
  Actual: 0

rails test test/controllers/sessions/omniauth_controller_test.rb:10


Finished in 2.899824s, 0.3448 runs/s, 0.3448 assertions/s.
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips

即使使用-b,我也没有得到“Authentication failure!“的回溯。我假设这是因为:

  • Omniauth正在捕获错误
  • 测试环境正在模拟第二个http连接,而此错误发生在第二个连接中

我已经查看了log/test.log。我没有看到任何发生此错误的线索。
如何获得“身份验证失败!”错误的回溯,以便知道在哪里放置调试器调用并进一步检查?

ax6ht2ek

ax6ht2ek1#

通过在容器中运行以下命令,我能够找到放置调试器调用的位置:

$ grep 'Authentication failure!' -rin `find / -iname 'gem*' -type d `

但是如果minitest有办法把backgrace带到最前沿,我很想知道。

相关问题