How to Exclude Rspec tests matching a specific tag


This article describe how to exclude tests matching a specific tag.


🏈 Preparation

Please set an option to give us a cleaner syntax: spec/spec_helper.rb

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
end

🐹 Adding tag

describe '#do_something', :skip do
it 'returns something' do
expect(described_class.new.do_something).to eq '...'
end
end

🐡 Tag based execution

Run everything, except for :skip tests:

$ bundle exec rspec --tag \~skip spec/

If you want to run tests mathcing :skip tag:

$ bundle exec rspec --tag skip spec/

😼 Special Thanks

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!