Created
November 15, 2016 18:52
-
-
Save selmanj/8fe1a648143e5bc33316e36416ad1972 to your computer and use it in GitHub Desktop.
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
require 'minitest/autorun' | |
# My helper | |
class AddTestHelper | |
def self.add_crud_tests(x) | |
x.send(:define_method, :test_foobar) { puts 'testing foobar' } | |
end | |
end | |
# My test class | |
class TestMyClass < Minitest::Test | |
AddTestHelper.add_crud_tests(self) | |
def test_thing | |
assert_equal 'foo', 'foo' | |
end | |
end | |
# Output: | |
# ~/src/ruby-add-test-experiment $ ruby -Ilib:test test_my_class.rb | |
# Run options: --seed 41063 | |
# | |
# # Running: | |
# | |
# testing foobar | |
# .. | |
# | |
# Finished in 0.000845s, 2367.2841 runs/s, 1183.6421 assertions/s. | |
# | |
# 2 runs, 1 assertions, 0 failures, 0 errors, 0 skips |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment