Poltergeist 与 Rspec 比较匹配器不兼容?

Poltergeist incompatible with Rspec comparison matcher?

我有如下断言:

expect(int_var).to be < 5

它在 selenium 驱动程序中工作正常,但是当我 运行 它在 poltergeist 中时,我得到

undefined method '<' for nil:NilClass (NoMethodError)

poltergeist真的不支持这个吗?有没有更好的比较匹配方式?

我怀疑这是 Poltergeist 造成的。当您的测试需要一个整数时,您有一个 nil 值。尝试:

expect(nil).to be < 5

你会看到同样的错误。