Today I Learned

hashrocket A Hashrocket project

About rspec test tags

You want a way to run a specific sub-set of your specs. Well RSpec has a tag metadata that you can add to make things a lot nicer:

describe "my awesome code", :awesome do
  # some set of awesome tests

Now I just run rspec --tag awesome and you’re just going to run your block!

It also takes a negation, which means that if you want to run everything else you just use rspec --tag ~awesome.

You can also use this to add behavior to the way examples are dealt with via RSpec.configure

RSpec.configure do |config|
  config.append_after : each do |ce|
    if ce.metadata[:awesome]
         # do something awesome to the example