Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To easily limit the execution of RSpec tests while you are developing use the
- power of the `.rspec` opts file and RSpec tags.
- Tags can be added to any RSpec method `describe`, `context`, `it`, etc.
- The are simply arguments passed as a Hash to the method.
- ```ruby
- describe 'foo', focus: true do
- context 'bar', slow: true do
- it 'uses the database', db: true do
- ```
- The above example shows a couple different tags you can try. They can really be
- any valid Ruby symbol but `:focus` and `:skip` are traditional.
- You can call `rspec` to either run only the tags or to ignore the tags.
- `be rspec --tag ~db` skips all the `:db` tagged specs.
- `be rspec --tag focus` runs all the specs inside the `describe` block.
- RSpec uses an opt file that can exist in your local directory and your home
- directory. The home directory file sets your global defaults but the local file
- will override those settings.
- Copy and paste this into your command line to get started with running `:focus`
- specs via tags instead of having to always pass a line number to your `rspec`
- commands.
- echo "--color
- --no-profile
- --format Fuubar
- --deprecation-out log/rspec-deprecations.log
- --tag focus" > ~/.rspec
- Remove the `--tag focus` line to run all specs (hint the above snippet will
- tell RSpec to *only* run `:focus` tagged specs).
- Run `rspec --help` for more ways to customize your RSpec experience.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement