When running my RSpec tests from the command line, how can I exclude tests matching a specific tag?
Running tests by their file or directory names is the most familiar way to run tests with RSpec. RSpec can take a file name or directory name and run the file or the contents of the directory. So you can do: rspec spec/jobs to run the tests found in the jobs directory.
RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.
One can stop the RSpec test in the middle by pressing ctrl-C twice.
Use ~@
with the name of the tag, like this:
rspec spec --tag ~@slow
See the docs: https://www.relishapp.com/rspec/rspec-core/docs/command-line/tag-option
I'm now running my tests on Spork, and it seems as though it ignores this directive. Not sure why.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With