
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
yet another tags implementation for Minitest
Note: backupify/minitest-tagz is no longer maintained. Please refer to this fork for the maintenance.
Add this line to your application's Gemfile:
gem 'minitest-tagz'
In your test_helper.rb
you'll need to require Minitest::Tagz
. You'll also
want to tell Tagz
which tags you want to use. I suggest using the TAGS
environment
variable:
require 'minitest/tagz'
Minitest::Tagz.choose_tags(*ENV['TAGS'].split(',')) if ENV['TAGS']
Then, for example, you can run all tests with the :fast
and :login
tags:
bundle exec rake test TAGS=fast,login
You can also run all test without a particular tag or mix any subset.
Below we run all the :fast
tags, but not the :login
tags
bundle exec rake test TAGS=-login,fast
Here's another example which will allow you to drop in a :focus
tag wherever you want:
require 'minitest/tagz'
tags = ENV['TAGS'].split(',') if ENV['TAGS']
tags ||= []
tags << 'focus'
Minitest::Tagz.choose_tags(*tags, run_all_if_no_match: true)
Minitest::Tagz
works with both Minitest::Test
and Minitest::Spec
. You can declare
tags by using the tag
helper.
# Using Minitest::Spec
class MySpec < Minitest::Spec
tag :fast, :unit
it 'should run' do
assert true
end
tag :fast
it 'should not run' do
refute true
end
it 'also should not run' do
refute true
end
end
# Using Minitest::Test
class MyTest < Minitest::Test
tag :fast
def test_my_stuff
assert true
end
end
With Minitest::Spec
adding tags to a describe
will add the tags to all of the
tests in the block:
class MySpec < Minitest::Spec
tag :login
describe 'all tests in this are tagged with :login' do
it 'tests this' do
assert true
end
it 'also tests this' do
assert true
end
end
end
You can also use the run_all_if_no_match
option to do something like always have a :focus
tag on-demand:
Minitest::Tagz.choose_tags(*ENV['TAGS'].split(','), run_all_if_no_match: true) if ENV['TAGS']
This is how we add tag :focus
in our projects:
require 'minitest/tagz/focus'
You can save a reference to the tagger and watch the internal state machine:
tagger = tag :focus
it 'should work' do
require 'rubygems'; require 'pry'; binding.pry
end
pry(main)> tagger
#=> #<Minitest::Tagz::Tagger:0x007fa296102008 @owner=#<Class:0x007fa2957317b8>, @patchers=[Minitest::Tagz::MinitestPatcher], @pending_tags=[:focus], @state="applying_tags">
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that minitest-tagz demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.