Last active
July 5, 2021 20:40
-
-
Save JoshCheek/e8c6fda8cc8793b6ee6b to your computer and use it in GitHub Desktop.
Before all and after all in minitest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def alert(color=:default, message) | |
colors = {default: 0, black: 30, red: 31, green: 32, orange: 33, blue: 34, magenta: 35, teal: 36, white: 37} | |
$stdout.puts "----\e[#{colors[color]}m#{message}\e[0m----" | |
end | |
alert :red, 'before all tests' | |
at_exit { alert :red, 'after all tests' } | |
require 'minitest/autorun' | |
class SomeTest < MiniTest::Test | |
i_suck_and_my_tests_are_order_dependent! | |
def setup | |
alert :orange, 'before each' | |
end | |
def teardown | |
alert :orange, 'after each' | |
end | |
def test_1 | |
alert :magenta, 'in test 1' | |
end | |
def test_2 | |
alert :magenta, 'in test 1' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment