【问题标题】:RSpec: Troubleshooting failing test that works for some devs and not othersRSpec:对适用于某些开发人员而不适用于其他开发人员的失败测试进行故障排除
【发布时间】:2015-08-20 23:16:14
【问题描述】:

希望有人能指导我解决一个失败的规范,该规范在 CI 和我的台式机上通过,但在我的笔记本电脑 (MacBook) 上失败。

这是失败:

$ rspec spec/features/media_files_spec.rb

Randomized with seed 39713
WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt. You're using version 4.8.7.
....F

Failures:

  1) MediaFiles upload additional file to section
     Failure/Error: expect(page).to have_css(".photoset .photo", count: 2)
       expected to find css ".photoset .photo" 2 times, found 1 match: ""
     # ./spec/features/media_files_spec.rb:43:in `block (2 levels) in <top (required)>'
     # ./spec/support/background_jobs.rb:14:in `block (3 levels) in <top (required)>'
     # ./spec/support/background_jobs.rb:5:in `run_background_jobs_immediately'
     # ./spec/support/background_jobs.rb:13:in `block (2 levels) in <top (required)>'

Finished in 12 seconds (files took 3.03 seconds to load)
5 examples, 1 failure

Failed examples:

rspec ./spec/features/media_files_spec.rb:24 # MediaFiles upload additional file to section

我下周要去旅行,所以想让这台笔记本电脑稳定下来,但不知道为什么这在通过其他地方时在本地失败?不知道从哪里开始。想法?

【问题讨论】:

  • 您的台式机上的Qt 版本是否出现相同的错误(在这种情况下,它是无关的)?在这种依赖关系中可能存在某种奇怪的差异,并且是依赖于系统的东西,而不是由 Gemfile/bundler 保持不变的东西。
  • 是的。好奇,但两台机器上的 Qt5 错误相同(弃用警告)
  • 有时这类事情与所需文件的加载顺序有关。加载顺序取决于文件系统,除非您明确订购它。(例如 linux/osx 不同)您可能会尝试对任何需要的文件进行排序。 Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }

标签: ruby-on-rails ruby-on-rails-4 rspec rspec-rails capybara-webkit


【解决方案1】:

发布我自己的答案,因为也许这可以帮助其他人。

原来这是我的.env 在故障机器上的问题。一些 ENV 变量不同步。

顽固的坚果!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-16
    • 1970-01-01
    • 2018-08-05
    • 2011-01-19
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多