Created
May 3, 2009 00:17
-
-
Save tinogomes/105768 to your computer and use it in GitHub Desktop.
Test::Unit::TestCase with PWD methods
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 'test/unit' | |
module Test | |
module Unit | |
module TestCase | |
def turn_public_methods(klass) | |
klass.class_eval do | |
private_instance_methods.each { |instance_method| public instance_method } | |
private_methods.each { |method| public_class_method method } | |
end | |
def p80(*args) | |
p '*'*80 | |
args.each {|text| p text } | |
yield if block_given? | |
p '*'*80 | |
end | |
end | |
module Assertions | |
public | |
def assert_true(boolean, message=nil) | |
_wrap_assertion do | |
assert_block("assert should not be called with a block.") { !block_given? } | |
assert_block(build_message(message, "<?> is not true.", boolean)) { boolean.class == TrueClass } | |
end | |
end | |
public | |
def assert_false(boolean, message=nil) | |
_wrap_assertion do | |
assert_block("assert should not be called with a block.") { !block_given? } | |
assert_block(build_message(message, "<?> is not false.", boolean)) { boolean.class == FalseClass } | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment