RSpec > Is there a way to run all tests with one command?

后端 未结 5 1379
萌比男神i
萌比男神i 2021-02-02 07:44

Is there a command that does this? I\'ve searched but can not find anything

5条回答
  •  滥情空心
    2021-02-02 08:41

    1. Create a .rspec file in the root of your project
    2. Add the path to where your specs are e.g.

      --default-path test/spec/

    3. Add the pattern of how your files are named e.g.

      --pattern ****/*.spec

    4. Run rspec and it should pick all your specs and run them :)

    default-path and pattern are simply command line arguments, which means you can also add any other command line argument that rspec takes (can run rspec --help to see the available options)

    According to https://www.relishapp.com/rspec/rspec-core/v/2-0/docs/configuration/read-command-line-configuration-options-from-files you can also put the options in ~/.rspec, which will make the options available globally. Local .rspec file options will override the global options.

提交回复
热议问题