Rails RSpec 无效选项:--format

Rails RSpec invalid option: --format

$ rspec spec --format documentation
... test results
invalid option: --format
Test::Unit automatic runner.
Usage: ...

为什么 rspec 警告我这个选项?测试结果完全以这种格式打印 "documentation",但带有此警告和用法。

$ bundle show | grep rspec
  * rspec-core (3.2.0)
  * rspec-expectations (3.2.0)
  * rspec-mocks (3.2.0)
  * rspec-rails (3.2.0)
  * rspec-support (3.2.1)

$ bundle show | grep test-unit
  * test-unit (3.0.8)

这个选项在官方文档中。 https://relishapp.com/rspec/rspec-core/v/3-2/docs/command-line/format-option

那到底是怎么回事?

解决。 rspec 与 gem 测试单元冲突。

test-unit's test runner was also trying to parse CLI args and was complaining about not understanding the --format arg

https://github.com/rspec/rspec-rails/issues/1312