简体   繁体   中英

How to configure guard-rspec to ignore a directory when all the test cases are running?

Lets say I have three directors in my spec folder; features, test, integration. When I run bundle exec guard and press enter, is there a way that I can configure my Guardfile to ignore the test cases that are located in the integrations directory?

In your Guardfile, you can specify the command to use when running all specs . You can specify an rSpec command with a file exclude pattern to run everything but the integration specs:

guard :rspec,
      cmd: 'bundle exec rspec', 
      run_all: { cmd: 'bundle exec rspec --exclude-pattern "**/integrations/*_spec.rb"' } do
  # ...
end

You might have to tweak this a bit depending on what you need exactly, see the links in the answer for the relevant bits of documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM