Skip to content

Instantly share code, notes, and snippets.

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 alexanderadam/aaf5f2399968da8bdc6080cbc6b6576e to your computer and use it in GitHub Desktop.
Save alexanderadam/aaf5f2399968da8bdc6080cbc6b6576e to your computer and use it in GitHub Desktop.
Before all and after all in minitest
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