RSpec fails to run --bisect, with error: undefined method `run' for #<RSpec::Core::Bisect::Server>

RSpec fails to run --bisect, with error: undefined method `run' for #<RSpec::Core::Bisect::Server>

我目前正在升级一个相当大的 Rails 应用程序,从 Rails 3 --> Rails 4(或者可能是 5)。

我目前正处于 Rails v4.0.13 应用程序的阶段,运行 宁 Ruby v2.1.5。测试套件在 RSpec v3.5.2 上 运行ning,并且 green(哇哦!),但不幸的是有一些间歇性故障。

我希望在进一步升级之前找出这些失败的原因,使用 rspec --bisect

然而,当我 运行 rspec --bisect (有或没有其他参数)时,我得到以下错误:

Bisect started using options: ""
Running suite to find failures...

Bisect failed! Failed to get results from the spec run. Spec run output:

(druby://127.0.0.1:33858) /home/tom/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/drb/drb.rb:1588:in `perform_without_block': undefined method `run' for #<RSpec::Core::Bisect::Server:0x00000001e71430> (NoMethodError)
        from (druby://127.0.0.1:33858) /home/tom/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/drb/drb.rb:1548:in `perform'
        from (druby://127.0.0.1:33858) /home/tom/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/drb/drb.rb:1626:in `block (2 levels) in main_loop'
        from (druby://127.0.0.1:33858) /home/tom/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/drb/drb.rb:1622:in `loop'
        from (druby://127.0.0.1:33858) /home/tom/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/drb/drb.rb:1622:in `block in main_loop'
        from /home/tom/.rvm/gems/ruby-2.1.5@<project-name>/gems/rspec-core-3.5.2/lib/rspec/core/drb.rb:23:in `run'
        from /home/tom/.rvm/gems/ruby-2.1.5@<project-name>/gems/rspec-core-3.5.2/lib/rspec/core/invocations.rb:19:in `call'
        from /home/tom/.rvm/gems/ruby-2.1.5@<project-name>/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:69:in `run'
        from /home/tom/.rvm/gems/ruby-2.1.5@<project-name>/gems/rspec-core-3.5.2/lib/rspec/core/runner.rb:45:in `invoke'
        from /home/tom/.rvm/gems/ruby-2.1.5@<project-name>/gems/rspec-core-3.5.2/exe/rspec:4:in `<main>'

有没有人知道是什么原因造成的,或者我如何才能找到原因?

到目前为止我已经尝试了一些方法,但无济于事:

还值得注意的是,我在这台计算机上有 other Rails 项目,运行ning --bisect 工作正常 -所以我认为这不是系统库兼容性问题。我想这一定与项目配置有关——但是 什么?!(我什至看不到应用程序回溯线索??)

编辑: 由于尚未找到解决方案,我继续升级应用程序。现在是 运行ning Rails v4.2.7Ruby v2.3.1,所有规格都通过了(但仍然存在一些订购问题)。 运行宁rspec --bisect时的报错信息不变。

希望不大,但您有 .rspec 文件吗?

我能够在一个空的 rails 项目上重新创建一个类似的错误,并将它添加到其中。出于某种原因 运行ning rspec --bisect --drb 引发了这个问题。

spork 文档建议将 --drb 直接添加到 .rspec 文件。所以请确保它已被删除,当你 运行 只是 rspec --bisect 它应该工作。

我已经看到这个错误并通过绕过 spring 和 spring-commands-rspec.

修复了它

不要用bin/rspec --bisect,试试:

# Stop spring
bin/spring stop

# Ensure rspec isn't using spring
bundle exec rspec --bisect