Search code examples
ruby-on-railsrspecrspec-rails

Rails RSpec invalid option: --format


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

Why rspec warn me about this option? Test results printed exactly in this format "documentation", but with this warning and usage.

$ 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)

This option is in the official documentation. https://relishapp.com/rspec/rspec-core/v/3-2/docs/command-line/format-option

So what's wrong with it?


Solution

  • Resolved. rspec conflits with gem test-unit.

    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