Skip to content

Instantly share code, notes, and snippets.

@blowmage
Created October 21, 2013 14:18
Show Gist options
  • Save blowmage/7084650 to your computer and use it in GitHub Desktop.
Save blowmage/7084650 to your computer and use it in GitHub Desktop.
minitest-assertify
module MiniTest
module Assertify
module Lifecycle # :nodoc:
# Hook into Minitest's Lifecycle to alias methods when tests are run.
def before_setup # :nodoc:
self.class.public_instance_methods.grep(/\Arefute_/).each do |method|
new_method = method.to_s.sub("refute_", "assert_not_").to_sym
class_eval do
alias_method new_method, method
end
end
super
end
end
end
class Unit # :nodoc:
class TestCase # :nodoc:
# Register the Lifecycle
include MiniTest::Assertify::Lifecycle
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment