aboutsummaryrefslogtreecommitdiffstats
path: root/lib/minitest/spec.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-21 00:39:57 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-21 00:39:57 +0000
commit17dde49326abb035ef14cd4be8b33337c6248e82 (patch)
tree56d367373041ffb1c72e6b288fda481c789eddce /lib/minitest/spec.rb
parentba661182a40a486f089e63889897ab98d9db85b5 (diff)
downloadruby-17dde49326abb035ef14cd4be8b33337c6248e82.tar.gz
Imported minitest 3.3.0 (r7676)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/minitest/spec.rb')
-rw-r--r--lib/minitest/spec.rb37
1 files changed, 15 insertions, 22 deletions
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index 02c57ec7ef..1d85cd9f32 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -162,10 +162,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
#
# Equivalent to MiniTest::Unit::TestCase#setup.
- def self.before type = :each, &block
- raise "unsupported before type: #{type}" unless type == :each
-
- add_setup_hook {|tc| tc.instance_eval(&block) }
+ def self.before type = nil, &block
+ define_method :setup do
+ super()
+ self.instance_eval(&block)
+ end
end
##
@@ -175,10 +176,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
#
# Equivalent to MiniTest::Unit::TestCase#teardown.
- def self.after type = :each, &block
- raise "unsupported after type: #{type}" unless type == :each
-
- add_teardown_hook {|tc| tc.instance_eval(&block) }
+ def self.after type = nil, &block
+ define_method :teardown do
+ self.instance_eval(&block)
+ super()
+ end
end
##
@@ -247,14 +249,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
end
# :stopdoc:
- def after_setup
- run_setup_hooks
- end
-
- def before_teardown
- run_teardown_hooks
- end
-
class << self
attr_reader :desc
alias :specify :it
@@ -290,11 +284,11 @@ module MiniTest::Expectations
#
# n.must_be_close_to m [, delta]
#
- # :method: must_be_within_delta
+ # :method: must_be_close_to
infect_an_assertion :assert_in_delta, :must_be_close_to
- alias :must_be_within_delta :must_be_close_to
+ alias :must_be_within_delta :must_be_close_to # :nodoc:
##
# See MiniTest::Assertions#assert_in_epsilon
@@ -450,12 +444,11 @@ module MiniTest::Expectations
#
# n.wont_be_close_to m [, delta]
#
- # :method: wont_be_within_delta
+ # :method: wont_be_close_to
- infect_an_assertion :refute_in_delta, :wont_be_within_delta
+ infect_an_assertion :refute_in_delta, :wont_be_close_to
- alias :wont_be_close_to :wont_be_within_delta
- # FIX: reverse aliases
+ alias :wont_be_within_delta :wont_be_close_to # :nodoc:
##
# See MiniTest::Assertions#refute_in_epsilon