Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created June 7, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/aacdd20b940ed641dea0cd8ab7777e3d to your computer and use it in GitHub Desktop.
Save myronmarston/aacdd20b940ed641dea0cd8ab7777e3d to your computer and use it in GitHub Desktop.
RSpec.configure do |config|
# Either put conditional logic in the hook...
config.around(:example) do |ex|
unless ex.metadata[:slow]
puts "Not tagged slow"
end
ex.run
end
# ...or auto-tag everything with `slow: false` in a way that
# individual groups/examples can override:
config.define_derived_metadata do |meta|
meta[:slow] = false unless meta.key?(:slow)
end
# ...and then filter on `slow: false`:
config.around(:example, slow: false) do |ex|
puts "Not tagged slow"
ex.run
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment